Skip to main content

Full text of "Hitachi Basic Master Level 3 MB 6890 Assembler Manual 1983"

See other formats


63228 




TACH 


$ 30 82 


BASIC MASTER LEVEL-3 



SALES DISTRIBUTOR: 

DELTA 



316 QUEEN STREET. MELBOURNE. 3000 
PHONE: 67 5452 


1983 


V.1.1 























































































( 1 ) 


CONTENTS 

PAGE 

CHAPTER Is CONCEPT OF ASSEMBLER AND DEBUGGER 1 

1 Necessary hardware system organisation 1 

2 Basic Master Level-3 and its assembler 

and debugger 2 

2-1 Memory map 4 

2-2 Transfer of Modes 8 

CHAPTER 2: ASSEMBLER 10 

1 Assembler organisation 10 

1-1 Assembler-organisation 10 

1- 2 Storage area 10 

2 Description of Assembly language 11 

2- 1 Legal letters and symbols 11 

2-2 Source program 11 

2-2-1 Statements 11 

2-2-2 Label field 13 

2-2-3 Operator field 

2-2-4 Operand field 14 

2-2-5 Comment field 16 

3 Assembler Pseudo - execute command 17 

4 Miscellaneous 20 

4-1 TAB symbols 20 

4-2 Description of operator 20 

4-3 Description of Index address format 21 

4-4 Reference definition of label name 21 

4- 5 Forced direct and forced extend address format 22 

5 Editor command 24 

5- 1 n command 27 

5-2 / command 28 

5-3 A command 29 

5-4 "space" command 30 

5-5 I command 31 

5-6 K command 32 

5-7 L command 33 

5-8 F command 35 

5-9 P command (1) 36 

5-10 P command (2) 37 

5-11 X command 39 

5-12 Y command 41 

5-13 S command 42 

5-14 V command 43 

5-15 M command 44 

5-16 A command 45 

5-17 AL command 46 

5-18 N command 46 

5-19 C command ' 47 

5-20 S command 48 

5-21 E command 49 

5-22 Error message 49 

6 Error message of assembler 50 


( 2 ) 


CHAPTER 3: 


CHAPTER 4 


CHAPTER 5 


C_ 

ONTENTS (CONTINUED) 




PAGE 

DEBUGGER 

51 

1 

Concept of debugger 

51 

2 

Storage area of debugger 

51 

3 

Debugger commands 

52 

3-1 

M command (MEMORY) 

54 

3-2 

D command (DISPLAY) 

55 

3-3 

B command (BREAK POINT) 

56 

3-4 

G command (GO) 

57 

3-5 

R command (REGISTER) 

59 

3-6 

S command''(STEP) 

60 

3-7 

C command (COMPARE) 

61 

3-8 

F command (FILL) 

62 

3-9 

T command (TRANSFER) 

63 

3-10 

E command (ESCAPE) 

65 

3-11 

A command (ASSIGN) 

65 

OPERATION OF BASIC MASTER LEVEL-3 

66 

1 

Conecpt 

66 

2 

Operation of MA-5100 (Cassette) 

66 

2-1 

Resaving of the assembler 

66 

2-2 

Loading of assembler and debugger 

67 

2-3 

Execution of assembler (Start) 

68 

2-4 

Execution of assembler 

70 

2-5 

Operation of debugger 

71 

3 

Operation of MA-5200 (Diskette) 

73 

3-1 

Operation of MA-5300 (32K BASIC) 

73 

3-1-1 

Resaving of diskette 

73 

3-1-2 

Loading of assembler 

74 

3-1-3 

Operation of assembler 

74 

3-1-4 

Execution of assembler 

77 

3-1-5 

Loading of debugger 

78 

3-1-6 

Operation of debugger 

78 

3-2 

Operation of MA-5301 (40K BASIC) 

79 

3-2-1 

Resaving of the program 

79 

3-2-2 

Loading of assembler and debugger 

80 

3-2-3 

Operation of assembler 

81 

3-2-4 

Execution of assembler 

83 

3-2-4 

Operation of debugger 

84 

4 

Simultaneous development of assembly and 



BASIC languages 

86 

4-1 

Usage of Memory area 

86 

4-2 

Development j^ocedure a 

87 

ASSEMBLY LANGUAGE 

88 


1 

Introduction 

88 

2 

Address format 

88 

2-1 

Implied address format 

89 

2-2 

Accumulator address format 

89 

2-3 

Immediate address format 

89 

2-4 

Direct address format 

90 


(3) 


CONTENTS (CONTINUED ) 

PAGE 


CHAPTER 5: ASSEMBLY LANGUAGE (CONTINUED) 

2-5 Extend address format 91 
2-5-1 Extend address format 91 
2-5-2 Extent indirect address format 92 
2-6 Register address format 94 
2-7 Index address format 95 
2-7-1 Constant off-set index address format 97 
2-7-2 Constant off-set index indirect address format 98 
2-7-3 Accumulator index address format 99 
2-7-4 Accumulator -index indirect address format 100 
2-7-5 Auto increment address format 101 
2-7-6 Auto increment indirect address format 101 
2-7-7 Auto decrement address format 101 
2-7-8 Autc decrement indirect address format 102 
2-8 Relative address format 102 
2-8-1 Short/Long branch 102 
2-8-2 Program counter relative address format 102 
3 Instruction and their details 104 


APPENDIX: MODIFICATION OF THE SOURCE TOP ADDRESS 

OF YOUR SOURCE PROGRAM 



( 1 ) 


1. CONCEPT OF ASSEMBLER AND DEBUGGER 


This assembler is to convert your source program, your assembly language 
program fitted for HD-6809 of Basic Master Level-3 (MB-6890), into object 
program (machine codes) and to load the object program into the desig¬ 
nated RAM memory location. 

The assembly language is written with mnemonic codes which have 1 to -1 
correspondence with the machine codes, and makes it easier to maintain 
your programs. 

Together with the assembler, the debugger is also available so as to 
debug your object program. This debugger having editor commands to 
compile your source program makes it easier to develop your programs. 

1. Necessary Hardware-System Organisation 

The assembler for Basic Master level-3 (MB-6890) is available either 
on cassette tape (MA-5100) or on diskette (MA-5200). MA-5100 works 

under the control of ROM BASIC through a cassette tape recorder as 
an I/O device and MA-5200 does under the control of DISK BASIC through 
a mini floppy disk unit as an I/O device. 

In Table 1-1-1 there are shown the necessary hardware organisations 
both for MA-5100 and MA-5200. 


COMPUTER AND DEVICE 

MA-5100 

MA-5200 

EXPLANATION 

1 Basic Master Level-3, MB-6890 

0 

0 

N.B.l 

2 Colour Display, C14-2170 

0 

0 . 

C14-2170 or K12-2055P needed 

3 Monochrome Display, K12-2055P 

4 Cassette Tape Recorder, TRQ-237 

0 


Usable for MA-5200 

5 Mini Floppy Disk Drive, MP-3540 

X 

0 

N .B .2 

6 Dot-Matrix Impact Printer, MP-1040 

0 

o 

0 

Necessary to output assembled 
list 


0 means: "Necessary". 

means: "Possible to use". 

X means: "Not needed". 


Table 1-1-1 Necessary Hardware Organisation for Assembler 

























(2) 


N.B.l For Colour Monitor (C14-2170), the cable for the monitor 
(MP-9770) is needed. 

♦ 

N.B.2 For a mini floppy disk drive unit, I/F cards (MP-1800, and 
MP-1801) are needed. MA-5300 (for 32KB system) or MA-5301 
(for 40KB system) is necessary as Basic Master Level-3 DISK BASIC. 

N.B.3 The RAM expansion card (MP-9717) is necessary to use the MP-5301 
Basic Master Level-3 DISK BASIC for the expansion of up to 
40KB memory size. 

N.B.4 The instructions of how to operate each I/O device are found 
in each manual. 


2. Basic Master Level-3, and its Assembler and Debugger 

' ' —. . S 

Both on MA-5100 (cassette tape) and MA-5200 (diskette) are assigned 
Assembler and Debugger under the file name of ASM9, DEGUB5A, and 
DEBUD70, as shown in Table 1-2-1. DEBUG 5A and DEBUG 70 have exactly 
the same functions, but they are loaded at the different memory locations. 


PROGRAM NAME 

FILE NAME 

MEMORY 

LOCATION 

Assembler 

ASM9 

&H5000 

&H6FFF 

Debugger 

DEBUG5A 

&H5A00 

&H69FF 

DEBUG70 

&H7000 

&H7FFF 


N.B. The memory locations of ASM9 and DEBUG5A overlaps, so 
you cannot use both programs at the same time. 

Table 1-2-1 Programs Written on MA-5100 and MA-5200 

The memory size for Basic Master Level-3 is 32K bytes, as a standard 
orgainsation. If more memory size is needed, use the RAM expansion 
card which extends up to 40K bytes. If you expand the memory at the . 
location of more than 9FFF in Hex, you cannot use the Assembler. Under 
the above mentioned conditions, a cassette tape recorder and a mini 
floppy disk unit are usable. MA-5100 is only used for a cassette 
tape device and MA-5200 used only for a mini floppy disk unit. The 
standard 32K bytes system organisation does not allow to use DEBUG70 
program in case where a mini floppy disk drive is used as an I/O 
device, because Basic Master Level-3 DISK BASIC overlaps with the 
DEBUG70 memory area. Only in the above mentioned case, DEBUG5A has 
to be used instead of DEBUG70. 

In Table 1-2-2 are shown the possible combinations of the available 
programs together with possible I/O devices. 



(3) 


RAM SIZE 

FILE NAME 

I/O DEVICES TO BE USED 

CASSETTE TAPE RECORDER 

MINI FLOPPY DISK 

! 

l 

32KB 

ASM9 

@ 


DEBUG5A 

0 

© 

DEBUG70 


X 

40KB 

ASM9 



DEBUG5A 

0 

0 

DEBUG70 

© 

W.'\ :: I 


©: Recommended combination 

0: Possible combination 

X: Impossible combination 


Table 1-2-2 Possible Combination of Programs with I/O Devices 


















(. 4 ) 


2-1 Memory Map 


RAM32KB 


RAM40KB 


$ 0000 


*1 User' s— 
Beginning 
Address of 
RAM 


Area for BASIC 
Variables 


Area for BASIC Character! 
Variables 



S6C00 
$ 7000. 


$7FFF. 


BASIC 

PROGRAM 




ASSEMBLY i:| 
LANGUAGE l 
SOURCE 
PROGRAM 


OBJECT 

PROGRAM 





S 0000 


User's 
Starting — [ 
Address of 
RAM 


BASIC 

PROGRAM 



-Top Address 
of Source 
Program 


* 3 

" End AD 
-ORG 

* 4 


•ASSEMBLY 
i LANGUAGE 
(SOURCE 
^PROGRAM) 


■Area for BASIC Variable 


Top Address of 
Source Program 


BASIC Stack 
System 


i+2 $ 4F00 —\ 

$ 5000 


End AD 


■Assembler 
Working Area 


|— Working 
Area For 
Debugger 


S6C00 
$ 7000 


S7FFF 


Before Assembler and Debugger are loaded, the 
BASIC command of CLEARx, &H4EFF should be 
executed without fail. 


* 1 : 

* 2 : 


Refer to Table 1-2-3 
Refer to Starting of Assembler at 
Section 2-3 in Chapter 4 
Refer to S Command at Section 5-20 in 
Chapter 2 

*4: Refer to Pseudo Commands of Assembler 

at Section 3 in Chapter 2 


$ 9FFF 



Working Area for 
Assembler 


Working Area for 
Assembler Debugger 


BASIC Stack System 


3: 


Area for BASIC Character Variable 


FIGURE 1-2-1 MEMORY MAP FOR MA-5100 (CASSETTE TAPE) 












( 5 ) 


Figure 1-2-2 Memory Map for MA-5200 (Diskette!. 


$ 0000 / 


RAM32KB 


$0000 


RAM40KB 


*1 User's 
Starting 


Address of 
RAM 


BASIC 

PROGRAM 


User's 
Starting 


Address of 
RAM 


Area for 

BASIC 

Variables 


mrrrry^p 


5ASSEMBLY 
|PROGRAM 
|(SOURCE 
£PROGRAM) 


?Jop Address 
of Source 
Program 


OBJECT 
j:PROGRAM 


•3 

'End AD 
-ORC 
* 4 


Area for BASIC 
Character $4F00 


Variables 


Working Area 
for DEBUGS 



BASIC Stack 
System 

+ 2 


$ 4 F0 0 


Working 55000 
Area for 
Assembler 


$ 6C00 
$ 7000 


$ 7 2Bfr 


DISK BASIC 
RAM AREA 


$ 7FFF-I 


$ 7FFF 


Area for BASIC Characte: 


Variables 


$ 9 2B8 


2 . 


Before Assembler or Debugger is loaded, 
the BASIC Command of CLEAR*, &H4EFF 
should be executed without fail. 

ASM9 and DEBUG5A have to be loaded 
alternately. 

The Above is valid for MA-5300 DISK BASIC 


$ 9FFF 


BASIC 




ASSEMBLY 

LANGUAGE 

(SOURCE 

PROGRAM) 





DISK BASIC 
RAM AREA 


-Area for BASIC variable 


-Top Address of Source 
Frogram 


■ End AD 

Vorking Area for Assemlbe 


"Working Area for Assemble 
Debugger 


—ORG 

-Object Program 


;Basic Stack System 
320 Bytes 


DISK BASIC MA-5300 can be used. In 
this case, DEBUC5A has to be used. 
The above is valid for MA-5301 DISK 
BASIC. 


* 1 : 

* 2 : 


*3: 

*4: 


Refer to Table 1-2-3 

Refer to Starting of Assembler at Section 3-1-3 
in Chapter 4. 

Refer to S Command at Section 5-20 in Chapter 2. 

Refer to Pseudo Commands of Assembler at Section 3 in Chapter 2. 















( 6 ) 


(1) The beginning address for users is different according to 

cassette based or disk based system as shown in Table 1-2-3. 

Table 1-2-3 User's Beginning Address of RAM 


SCREEN MODE 

USER'S STARTING ADDRESS 

MA-5100 

MA-5200 

40 Characters in normal mode 

SHOB68 

&HOF72 

80 Characters in normal mode 

&HOF68 

&H1372 

40 Characters in high-resolution mode 

&H2768 

&H2B72 

80 Characters in high-resolution mode 

&H4768 

&H4B72 


N.B.l The above mentioned starting addresses are valid under the 

organisation. Different I/F cards such as printer or RS-232C 
cards will affect user's starting address.. If you change FCB 
by using CONFIG program on DISK BASIC, the starting address 
will be greatly affected. For each case, refer to each 
detailed manual on how the starting address will be affected. 

N.B.2 As for the setting of screen mode, refer to the manual on 
Basic Master Level-3 BASIC or DISK BASIC. 

(2) The memory allocations are needed for Assembler and Debugger, as 
shown in Table 1-2-4. 

Table 1-2-4 RAM size for Assembler and Debugger 


PROGRAM NAME 

FILE NAME 

SIZE 

RAM ADDRESS *1 

WORKING AREA 

Assembler 

ASM9 

8KB 

&H5000-&H6FFF 

&H4FOO-&H4FFF 

Debugger 

DEBUG5A 

4KB 

&H5AOO-&H69FF 

&H6COO-&H6FFF 

DEBUG70 

4KB 

&H7000-&H7FFF 

&H6C00-&H6FFF *2 


*1: The memory allocations for ASM9 and DEBUG5A are overlapped. 

Therefore, you cannot use these at the # same time. 







































(7) 


*2: When you use both ASM9 and DEBUG70 at the same time, the 

working area for DEBUG70 overlaps with the memory allocation 
of ASM9, but the software design is made to share these memory 
areas by ASM9 and DEBUG70. 

(3) Your BASIC program will be loaded, beginning at the memory 
location as shown in Table 1-2-3. 

(4) The conversion area for BASIC characters is reserved automatically 
as shown in Talbe 1-2-5 when Basic Master Level-3 is switched on. 

Table 1-2-5 BASIC Character Conversion Area after Power-on 



RAM 

SIZE 

UPPER ADDRESS FOR 

BASIC PROGRAM 

STARTING ADDRESS FOR BASIC 
CHARACTER CONVERSION AREA 

ROM BASIC 

32KB 

SH7FFF 

&H7ED1 





40KB 

&H9FFF 

S.H9ED1 

DISK BASIC 

32KB 

&H72B7 

&H7189 

(MA-5300 & MA-5301) 

40KB 

&H92B7 

&H9189 


After you have switched on Basic Master Level-3, you can set the starting 
address by CLEAR Command. 


(5) The area for the BASIC variables and system stack will be assigned 
only by running your BASIC program. These are sizes are totally 
dependent upon your BASIC program. 

(6) The BASIC FRE function value is given by the following formula. 

FRE (0) = (Starting Address for BASIC Character Conversion) 

- (Upper Address for BASIC Variable Area + 1) 

- 14 *_(1) 

*: Number of bytes to be occupied in executing directly 
PRINT FRE (0) 

When you extend your memory size up to 40KB and FRE function 
value exceeds 3 2767 (7FFF in HEX) , the system will display the 
negative decimal value, " N". In this case only the number of 
bytes will be given by equation (2). 

FRE (0) = 65536 - N_(2) 

The source program of the assembly language will be stored at 
any location designated by a user. But you can not designate 
this address which is lower than user's RAM starting address. 


( 7 ) 



















( 8 ) 


End AD (Last Address for Storage of Your Source Program + 1) 
can be known by executing Editor command "S". 

(8) Object program (machine language) can be loaded sequentially 
at the RAM locations designated by ORG command. 

(9) In case of DISK BASIC (MA-5300 and MA-5301), the memory area 
will be occupied as DISK BASIC RAM as shown in Fig. 1-2-2. 

2-2 Transfer of Modes 

When you load Assembler and Debugger in Basic Master Level-3, the 

following 5 different modes exist: 

~1. -BASIC Mode 

2. Monitor Mode 

3. Editor Mode 

4. Assembler Mode 

5. Debugger Mode 

Figure 1-2-3 shown how to transfer between 5 different modes. 

Table 1-2-6 shows how to load Assembler and Debugger. 



*1: LOADM "<Device Name> : ASM9",, R is also possible. 

*2: LOADM "<Device Name> : DEBUG70",, R or LOADM" <Device Name> 

DEBUG5A",, R is also possible. 

Figure 1-2-3 Transfer between Different Modes * 








Table 1-2-6 Method of Loading Assembler and Debugger 


ASSEMBLER/DEBUGGER FILE NAME 


Debugger 




"DEBUG5A" 


"DEBUG70" 


LOADM"<Device Name) :ASM9" I RETURN 


LOADM"<Device Name) :ASM9" ,,R| RETURN 


LOADM"<Device Name) :DEBUG5A" | RETURN 


LOADM"(Device Name) :DEBUG5A",,R I RETURN 


LOADM"<Device Name) :DEBUG70" | RETURN 


LOADM"(Device Name) :DEBUG70”,,R | RETURN 



N.B. As for device names, refer to the manuals on Basic Master Level-3 BASIC or 
DISK BASIC- 


























( 10 ) 


2. ASSEMBLER 

1-1 Assembler Organisation 

Assembler (File Name:ASM9), is designed based on the fundamental conecpts. 

The following are the basic features: 

1) This assembler having the conversational editor makes it easy" to 
make and compile source programs and to transfer the programs to 
I/O devices and retrieve from them. This has the function of 
printing Assembler listing on a printer. 

2) The size of your source program which can be assembles at one 
time is 999 lines in maximum. 

3) It is possible to develop your programs by using both Assembly 
language and BASIC language. In this case both languages can 
be stored in RAM without being over-lapped. 

1-2 Storage area 

1) the size of assembler is 8KB and it will be stored at the locations 
of &H5000 to &H6GGG. 

2) The address area of &H4F00 to &H4FFF can be used as working area. 
Therefore, the memory area shown in figure 2-1-1 cannot be used 
for other purposes. The memory allocation with Debugger and BASIC 
should be referred in detail to Section 2-1 in Chapter 1 called 
Memory Map. 



Working for Assembler 


This area not- used for 
other purposes 


Figure 


2-1-1 Storage Area 


for Assembler 



( 11 ) 


2. Description of Assembly Language 
2-1 Legal Letters and Symbold 

The legal letters and symbols which can be used in your source programs 
are in the following: 

1) Numerals 

0, 1, 2, ., 9 (10 in all) 

2) Letters 

A, B, C, ., 2 (26 in all) 

3) Special Symbols are 'described below: 

* : When this is at the beginning of each line, the line 

becomes comments. When it is found in an operand, it 
shows relative address in reference to the line. 

# : This designates immediate address. 

% : Numerals following % are binary numbers. 

&H,$: Numerals and Letters (A to Z) following &H and $ stand 
for hexadecimal numbers. 

<: An operant following is of one byte. 

>: An operand following is of two bytes. 

{}: Two bytes bracketed (} are actual exectuable address. 

5) Other miscellaneous 

When more than one space or TAB (CTRL + I) is inserted in the 
comments or operands, you can use numerals, Katakana, Hiragana, 
alphabet, special symbols and Kana symbols. 

2-2 Source Program 

An expression having meaning itself is called a statement. Writing a 
series of statements for your own purposes consists of your source 
program. Source program described in this manual has to be written 
according to the rules of Assembler language of HD6809. 

2-2-1 Statements 

Statements are divided into 3 as shown in figure 2-2-1. 



Figure 2-2-1 Classification of Statements 










( 12 ) 


The functions of the 3 statements are describes in Table 2-2-1 


m 


•STATEMENT 

FUNCTION 

Executable 

Statement 

This is written by mnemonic codes having 1 to 1 
correspondence with machine codes. 59 different 
basic statements are the most important executable 
statements. 

Pseudo- 

Executable 

Statement 

This is a statement to control assembly language 
conversion" and is not converted to machine codes. 

There are 8 important pseudo-executable statements. 

Comment 

Statement 

To make it easy to follow up your program, comment 
statements are used. These are not converted into 
machine codes. These are printed on the assembly 
language list. By writing * at the beginning of a 
line, the following statements afterwards become 
comments. 


Table 2-2-1 Classification of Statements 

Among the above-mentioned statements, executable and pseudo-executable statements 
consist of 4 fields as shown in 2-2-2. 


LABEL 

OPERATOR 

OPERAND 

COMMENT 

FIELD 

FIELD 

FIELD 

FIELD 

i - 

Less Than 

80 Characters 

-♦ 


Figure 2-2-2 Organisation of Statement 

A statement usually consists of 4 fields in a line, but only operator field or 
operator and operand fields can be found. More than one space or TAB symbol 
has to be inserted between each field, and at the end of each statement "RETURN" 
(&HOD) has to be inserted. Within each statement you can use 80 characters 
in maximum. 




(13) 


2-2-2 Label Field 

In the label field, a label has to be used. A lable is used to refer 
to a statement by an instruction. 

1) A label has to consist of equal to or less than 6 characters 
(including alphabet and numerals) beginning with the alphabet. 

2) Register Names shown in Table 2-2-2 or "PCR" cannot be used 
as label names. EOF or label names having EOF cannot be used 
either. 

3) In the same program, lable names have to be defined consistently. 

4) The maximum number of labels to be used is 128. When your 
program exceeds 127, an error will take place. 

5) A label has to be started at the beginning of each line. If 
you insert a space at the beginning, the system understands 
that this is an operator. 

6) You can assign a label to an executable statement, but you 
cannot do a label to a pseudo-executable statement except 

for a few. Refer to pseudo-executable statements in Chapter 3 
for details. 


REGISTER NAMES 

SYMBOL 

REGISTER NAMES 

SYMBOL 

Accumulator A 

A 

X-Index Register 

X 

Accumulator B 

B 

Y-Index Register 

Y 

Double Accumulator 

D 

Hardware Stack Pointer 

S 

Condition Code Register 

CC 

User Stack Pointer 

U 

Direct Page Register 

DP 

Program Counter 

PC 


Table 2-2-2 Table of Registers 

2-2-3 Operator Field 

Commands legal to operator fields are of 2 kinds as follows: 

1) Mnemonic codes of HD6809. Refer to Table 2-2-3. 

2) Pseudo-executable commands. Refer to assembler pseudo-executable 
commands in Chapter 3. 




















(14) 


TABLE 2-2-3 CLASSIFICATION OF HD680 9 MNEMONIC CODES 



FUNCTION 

COMMANDS 

1. 

Addition and Subtraction 
concerning 8-bit Registers 

ADC, ADD, SBC, SUB 

2. 

Addition and Subtraction 
concerning 16-bit Registers 

ADDD, SUBD, ABX 

3. 

Multiplications (between 

8-bit Registers) 

MUL 

4. 

Comparison and Test 

CMP TST 

5. 

Shift Rotate 

ASL, ASR, LSL, LSR, ROL, ROR 

6. 

Logical Arithmetic 

AND, BIT, COM, NEG, EOR, OR 

7. 

Load and Store 

LD, ST, PSH,' PUL 

8. 

Branch over Short Range 

BCC, BCS, BEQ, BGE, BGT, BHI, 

BHS, BLE, BLO, BLS, BLT, BMI, 

BNE, BPL, BVC, BVS 


Branch over Long Range 

LBCC, LBCS, LBEQ, LBGE, LBGT, 

LBHI, LBHS, LBLE, LBLO, LBLS, 

LBLT, LBMI, LBNE, LBPL, LBVC, 

LBVS 

9. 

Unconditional Branch 

BRA, LBRA, BRN, LBRN, JMP, NOP 

10. 

Subroutine Control 

BSR, LBSR, JSR, RTS 

11. 

Interrupt Commands 

SWI, SW12, SW13, RTI, SYNC, CWAI 

12. 

Transfer between Registers 

EXG, TFR 

13. 

Load Command of Actual 

Address 

LEA 







































FUNCTION 


COMMANDS 


14. 

Sign Transaction Command 

SEX 


between 8 and 16 bits 

- 


Conversion 



N.B. As for HD6809 Mnemonic codes, refer to Chapter 5 for details. 

2-2-4 Operand Field 

In an operand field, coded information to be executed is written. Depending on 
instructions, operand fields are not always necessary. Depending on instructions 
multiple information is needed. In this case a comma separates two different 
kinds of information. 

In operand fields, legal formats are allowed as shown in Table 2-2-4. 

Table 2-2-4 Formats of Operand Fields 


FORMAT 


CLASSIFICATION 


Numeral 

Constants 


Character 

Constants 




Decimal Number, Hexadecimal Numbers 
(Followed by $ or &H), Binary Numbers 
(Followed by %) 


/Character strings/ 


Symbols (Label Names) or ‘(Relative 
Address) 


Numeral constants and symbols are allowed 
as terms of an equation. Arithmetic 
operators (+ and -) are allowed as 
operators of an expressions. 


ADDRESS 

FORMAT 


There are 8 different address formats of instructions. Refer 
to Address Format at Section 2 in Chapter 5 for details. 



















( 16 ) 


An example is shown below 


Memory 


Address 

Data 

Label 

Operator 

Operand 


0 0 0 A 

ABC 

EQU 

10 


0 0 0 2 

BB 

EQU 

2 




ORG 

&H 3 0 0 0 

3 0 0 0 

9 6 0 C 


L D A 

ABC+BB 

3 0 0 2 

D 6 0 8 


LDB 

ABC-BB 

3 0 0 4 

9 6 0 C 

" —- . V 

L D A 

ABC+2 

3 0 0 6 

D 6 0 8 


LDB 

A BC- 2 

3 0 0 8 

B 6 3 0 0 A 


L D A 

* -l- B B 

3 0 0 B 

F 6 3 0 0 1 


LDB 

* -10 

3 0 0 E 

B 6 3 0 0 E 


LD A 

10 +- * - A B C 

3 0 11 

EF 


FC B 

&HEF, ABC 

3 0 12 

0 A 




3 0 13 

A 6 0 A 


L D A 

ABC. X 

3 0 15 

5 4 


FC C 

/TEXT/ 

3 0 16 

4 5 




3 0 17 

5 8 




3 0 18 

5 4 


END 



2-2-5 Comment Field 

A comment field starts in an operand field by inserting more than one 
space or TAB symbol at the beginning. In comment fields, you can use 
numerals, Katakana, Hiragana, Alphabet, symbols, and Kana symbols that 
can be found on the keyboard of Basic Master Level-3. By using these 
you can state any comments as you like. Comments are not converted 
into machine codes in assembling your source program. They are output 
on your assemble list. Therefore, these make it easy for you to follow 
up your program. 



(17) 


3. ASSEMBLER PSEUDO-EXECUTABLE COMMANDS 


Assembler psuedo-executable commands are the ones to control Assembler, 
and they are not converted into machine codes. Pseudo-executable 
commands are described in operator fields. A few such commands needs 
labels and operands, and some do not need them. 


1) END (END of Program) 

(1) This is an pseudo-executable command to show the end of your 
program (Statements after "END" will never be assembled at 
all) . 


(2) You do not allow to use labels or operands. 

2) EQU (EQUate Symbol) 


(1) This is to assign numbers to labels 


(2) You can not omit labels nor operands. 
Example: 


LABEL 

OPERATOR 

OPERAND 

START 

EQU 

&HAOO 

AB 

EQU 

10 

AC 

EQU 

AB 

XY 

EQU 

YZ + AB 

YZ 

EQU 

&HFOO 


3) RMB (Reserve Memory Byte) 

(1) Memory bytes are reserved by the value of an operand. 

(2) You can omit labels. But operands will never be omitted. 


Example: 


Memory Address 

Label 

Operator 

Operand 

3000 


RMB 

2 

3002 

DATAl 

RMB 

10 

300C 

DATAX 

RMB 

1 


4) FCB (Form Constant Byte) 

(1) 8-bit data are sotred in memory area in correspondence to 
operands. Multiple operands are separated by commas. 

(2) When illegal characters found, the system stores zeros 
automatically. 


(3) 


You can omit labels. But operands will never be omitted. 


(18) 


4) FCB (Form Constant Byte) (Continued) 


Example: 


Memory Address 

Data 

Label 

Operator 

Operand 

3000 

FF 

. XYZ 

FCB 

&HFF 

3001 

AA 

ZXY 

FCB 

&HAA, 12 

3002 

OC 




3003 

OO 





5) FDB (Form Double Fyte) 

(1) 16-bit data are loaded into memory area according to operands. 
Multiple operands-are^separated by commas. 


(2) When illegal characters found, the system loads 0 there. 

(3) Lables can be omitted, but operands cannot. 

Example: 


Memory Address 

Data 

Label 

Operator 

Operand 

3010 

0001 

ONE 

FDB 

1 

3012 

0000 

DATA 

FDB 

,&HABC,&HF 

3014 

OABC 




3016 

OOOF 





6) FCC (Form Constant Characters) 

(1) This is to convert into JIS codes and to store in the memory 
location. 


(2) Legal characters are from $20 to $FE in JIS codes. 

(3) The system understands bracketed characters by 2/'s as legal 
ones. 

(4) Labels can be omitted, but operands cannot. 

Example: 


Memory Address 

Data 

Label 

Operator 

Operand 

3000 

42 

MESS I 

FCC 

/BASIC/ 

3001 

41 




3002 

53 




* 3003 

49 




3004 

43 

, 



ORG (ORGin) 






This pseudo-executable commands designates the starting 
address of the object program when your source program is 
converted into machine codes. 


( 1 ) 


(19) 


7) ORG (ORGin) (Continued) 

(2) ORG command can be used several times in the same program. 

(3) Labels cannot be used. Operands cannot be omitted. 

8) SETDP (SETDirect Page Pseudo Register) 

(1) This command assign a value to the Direct Page Pseudo 
Register, and tells the Assembler on the range (page) of 
the direct address format. 

(2) When you do not designate the page address*, the Assembler 
will set the value of Direct Page Pseudo Register to be zero 
by default. 

(3) The content of the Direct Page Pseudo Register set by SETDP 
command is valid until the content of the register is 
re-assigned by the new SETDP command. 

(4) The Direct Page Register (DPR) of HD6809 Microprocessor is 
not changed by SETDP command. Therefore, the content of DPR 
has to be set as the same value as that of Direct Page Pseudo 
Register by TFR or EXG command. 

(5) Labels cannot be used. Operands cannot be omitted. 

Example: 


Memory Address 

Data 

Label 

Operator 

Operand 

4001 

0064 

BUF 

RMB 

100 


0040 


SETDP 

&H40 

4065 

8640 


LDA 

#H40 

4067 

1F8B 


TFR 

A, DP 

4069 

8610 


LDA 

#&H10 

406B 

9701 


STA 

BUF 

* As for the page 

address, 

refer to 

the direct 

address format 


Section 2-4 in Chapter 5. 


( 20 ) 


4. MISCELLANEOUS 


The rules to describe the source program of the assembly language was 
described at Section 2 of "Description of Assembly Language" and 
Section 3 of "Assembler Pseudo-Executable Commands" in this Chapter. 
Additional rules are to be described further at this section. 


4-1 


TAB Symbol ( 


CTRL 


+ [Tj , $09) 


This TAB symbol is inserted between a label and an operator, between 
an operator and operand, and between an operand and a comment. 
Therefore, each field is adjusted properly. When your source program 
is assembled, this TAB symbol is neglected. When the system loads 
your source program, this occupies one byte for the storage. The TAB 
position is fixed as shown, in figure 2-4-1. In Figure 2-4-1 is shown 
the screen format of your source program on the CRT display. 


0 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 
1 i i i I i i i i ' i i i 1 i I i i ' i i i i i i_I_I_I_I—1—I—I—I—1—I—I—I—L_J—1_ 


/ 


PROMPT 

SYMBOL 


I A B C_ 

t LABEL 
I COMMAND 


LL D A — __i 


Sc H 4 1 


OPERATOR 


OPERAND 


FIRST TABSECONDTAB 


____i * A * — > A C C A 

: COMMENT 

THIRD TAB 


N.B. One space is automatically inserted when the TAB Symbol is used 
after the 30th column. 

Figure 2-4-1 Position of TAB 

4-2 Description of Operator 

No space is needed between the mnemonic symbol and register name. If 
a space is placed, an error takes place when assembled. 

Example: 


WRONG DESCRIPTION 

RIGHT DESCRIPTION 

LD A 

LDA 

4 -- 


ST U 

STU 

'-‘ 


CMP_p 

CMPD 

PSHJJ 

PSHU 








( 21 ) 


4-3 Description of Index Address Format 

An operand of index address format is described as follows: 

Expression , R R:Pointer Register 

When the expression takes the value of 0, you can omit "0" or 
You can just write the register name only. 

Example: 


LDA 

LDA 


‘ V In each case they have the same meaning of LDA o,X. 
r X J 


The same rule will be applied- to automatic increment and automatic 
decrement. 


4-4 Reference Definition of Label Name 


It is possible to make a reference to and define a previous statement. 
In case of the reference to more than 2 statements, the date becomes 
zero. 


Example: 

Memory Address 


Data 

Label 

Operator 

Operand 

0041 

LI 

EQU 

L2 ^ 

0041 

L2 

EQU 

' &H41“ / 

0044 

L3 

EQU 

L2+3 


previous statemen 


If before a statement defining a label there is a statement referring to 
this label, the particular statement referring to the label is treated 
as extended address format or as 16-bit offset. 


Example: 


ry Address 

Data 

Label 

Operator 

Operand 


0041 

LI 

EQU 

L2 


0041 

L3 

EQU 

&H41 




ORG 

&H3000 

3000 

B60041 


LDA 

LI 

3003 

9641 


LDA 

L2 

3005 

A6890002 


LDA 

L3, X 


0002 

L3 

EQU 

2 


( 22 ) 


4-5 Forced Direct and Forced Extended Address Format 

By putting ""or"" at the beginning of an operand, the operand value 
becomes one byte or two bytes. The address formats applying forced 
direct or forced extended address formats are in the following: 

(1) Direct Address Format . 

(2) Extended Address Format 

(3) Extended Indirect Address Format 

(4) Index Address Format (but no applicable to Accumulator Offser, 
Auto-increment, or Auto-decrement) 

1) When Forced Extended Address Format ( ) is applied to Direct 
Address Format, the system assembles as Extended Address Format. 

2) When Forced Direct Address Format ( ) is applied to Extended 
Address Format, the lower one byte of an operand becomes 
valid and the system assembles as Direct Address Format. When 
in this case the higher one byte of an operand is different 
from the value of the Direct Page Pseudo Register, the effective 
address is different by using Forced Direct Address Format. 
Therefore, an error takes place when assembled. 

3) When Forced Direct Address Format ( ) is applied to Extended 
Indirect Address Format, the higher one byte is assembled as 
"$ 00 ". 

4) When Forced Extended Address Format ( ) is applied to Index 
Address Format, the system assembles as 16-bit offset. When 
Forced Direct Address Format ( ) is applied, the lower one 
byte of an operand becomes valid and the system assembles as 
8-bit offset. Except that the higher one byte of an operand 
is "$00", the system will issue an error message. In case of 
0-bit offset and 5-bit offset, Forced Direct Address Format ( ) 
is neglected. 

Example: 


Memory Address 

Data 

Label 

Operator 

Operand 


0040 


SETDP 

&H40 

4000 

B64001 


LDA 

>&H4001 

4003 

9612 


LDA 

<LABELl 

4005 

A69F0056 


LDA 

>CLABEL2l 

4009 

A6890001 


LDA 

>1, X 

400D 

A68856 


LDA 

<LABEL2, 


4012 

LABEL1 

EQU 

&H4012 


0056 

LABEL2 

EQU 

&H56 


N.B. When Forced Direct Address Format (<) or Forced Extended 

Address Format (>) is bracketted by Cl for Extended Indirect 
Address Format, it works in the same way as in the above 
example. 


4-5 Forced Direct and Forced Extended Address Format 


4) (Continued) 
Example: 


LDA 

STA 


C<LABEL 1 
< CLABEL 1 



I24 ) 


5. EDITOR COMMANDS 

When the system works under the Assembler mode, it waits for editor 
commands. Inputting editor commands makes the system edit your 
files and assemble your source program. 

This Assembler understands that your source program consists of each * 
statement on each line, and editing working is executed by designating 
the particular line to be modified. 

There are 21 editor commands in all. They are functionally divided 
in the following: 

(1) Moving the particular v line to be modified 

(2) Insertion and deletion 

(3) Listing, searching and exchanging 

(4) Filing, Verifying, and merging 

(5) Assembling 

(6) Others 

The assembling command is treated as one of editor commands, and 
the system waits for the next editor command as soon as the assembling 
work is finished. Therefore, the modification can be easily made. 

This also makes it easy to work your program. 

In Table 2-5-1 is shown the table of editor commands. In Section 5-1 
and thereafter each command is described in detail. 


(25) 


Table 2-5-1 Table of Editor Commands 



CLASSIFICATION NO COMMAND 


n command 


FORMULA 



Moving the 
line to be 
modified 


2 / command 


3 A command 



"Space" 

Command 


’Space" Characters 




I 


Insertion 

and 

Deletion 


5 I command 


I Characters 




6 K command 



L command 




The system moves nth line 
to be modified, and displays 
the content of the line on the 


screen. 


The system moves the nth line 
in advance, and displays the 
content of.the line on the 


screen. 


The system moves the nth line 
beforehand, and displays the 
content of the line on the 


screen. 




The system adds the input 
characters after the end of the 
line to be modified and this 
becomefe the new line. 


The system adds the input 
characters at the beginning of 
the previous line to be 
modified, and the previous 
line becomes the one to be 
modified. 


The system kills the n lines 
including the line to be 
modified. The next line 
becomes the one to be modified. 
The content is displayed on 
the screen. 


The system displays the 
contents of the n lines 
including the present line 
to be modified. Afterwards, 
the next line becomes the 
one to be modified. 







































(26) 


CLASSIFICATION 


NO 


COMMAND 


FORMULA 


FUNCTION 


Listing, 

Searching, 

and 

Modifying 


F command 


P command 


10 


P command 


11 


X command 


12 


Y command 


F characters 


RETURN 


The system searches the same 
character pattern from the 
line to the last line; The 
first line where the same 
input character pattern is 
found becomes the present 
line to be modified. The 
content of the line is 
displayed on the screen. 


P RETURN 


The content of the present 
line to be modified is 
displayed on the screen. 


P Characters 


RETURN 


Some part of the line to be 
modified is replaced with 
the input characters (line 
editing). 


X Previous 

Characters/New 

Characters 


RETURN 


Within .the line to be 
modified, the system 
searches the previous 
characters designated and 
the previous ones are 
replaced with the new ones 
if found. The new line is 
displayed on the screen. 

If the system cannot find 
the match, nothing is displayed 
on the screen. 


Y Previous 

Characters/New 

Characters 


RETURN 


X command is executed from the 
line to be modified to the 
last line. Only replaced 
lines are shown on the screen. 


Saving, 
Verifying, 
and 

Merging 


13 


S command 


S "Pro gram 
Name" I RETURN 


The system saves your program 
from the first line to the 
line together with the 
program name either on cassette i 
tape or on diskette. ' 


14 


V command 


V "Program 


Name" RETURN 


The system verifies that the 
check sum of your source 
program stored on the RAM is 
the same as that on cassette 
tape. 







































(27) 


CLASSIFICATION 

NO 

COMMAND 

FORMULA 

FUNCTION 


15 

M command 

M "Program Name" 

| RETURN 

The program on cassette tape 
or on diskette is merged after 
the last line to be modified 

Assembling 

r 

16 

A command 

A RETURN 

OR 

A, RETURN 

Assembling of your program 
is executed and the assembled 
list is displayed on the 
screen. In case of A, RETURN, 
list is displayed one screen 
by one. 


17 

AL command 

AL | RETURN 

Assembled list is output on 
a printer. 

Others 

18 

N command 

N RETURN 

The system displays the 
number of the present line to 
be modified. 


19 

C command 

C "New Prompt 
Character" 

RETURN 

The previous prompt mark is 
replaced with the new one 
designated in the command. 

This prompt mark is used as the 
demarcation code for P, X, and 

Y, commands. 


20 

S command 

S | RETURN 

• 

The system displays the last 
address of your source program 
plus one. The system displays 
as follows: 

End AD = ?XXXX 


21 

E command 

E 

The system returns to the 

BASIC mode. 


5-1 n Command 


1 . 

2 . 


Formula 


n 


RETURN 


(n: 


Positive integer) 


Function 

The system moves the line to be modified, and the content of the 
line is displayed on the screen. 











































3. Operation 


(1) While the system is waiting for an editor command, you can key 
in the desired number. If you make a mistake in keying in, you 
can delete the numbers by using DEL | key. You can key in the 
new numbers. 


(2) When you hit the 


RETURN 


key, the system moves to the designated 


nth line to be modified, and displays the content of the line. 
The system waits for the next editor command. 


(3) The number of a line has to be designated within 3 decimal 
digits (1 to 999). 

(4) Others 

If you input the line number which exceeds the last line of 
your source program,' the EOF line becomes the one to be modified. 
The system displays EOF. 


N.B.l The assembler can handle the 999 lines of your source program in 
maximum. 


N.B.l The system automatically inserts the EOF line (End of File) 
the next line after the last line of your source program. 


Example: 


in 


5-2 /Command 


1 . 

2 . 



/L 4 

LDX- 

DECB 

PMC- 

modified, 
the screen. 

ARP •_,_,,_, 

■—» A D U 

. . Y Y _ 

L D A — 

JMP 

Prompt Mark *— 
Line to be Modified — 

<- 

tr 

< 

co 

\ 

RNF_ 


/_ 


Formula /n | RETURN | (n: Positive integer) 


T 

Blinking Cursor 
nth line in advance, 


Function 

The system moves the line to be modified to the 
and displays the content. 

Operation 

(1) While the system is waiting for an editor command, jar key in 
the number of the lines followed by "/" key which you want to 
move. If you ma ke a mistake in keying in, you can delete by 
key. You can key in the new numbers. 


( 2 ) 


using the 
the 


DEL 


RETURN 


key is pushed, the system moves to the nth 
The content is shown on the 


When 

line in advance to be modified, 
screen. The system is waiting for the next editor command to 
come. 


(3) The number has to be within 3 decimal digits (1 to 999). 

(4) If the input number is 1, you can omit it. 

4. When you want to move beyond the last line of your source program, 
EOF becomes the line to be modified. 









(29) 


Example: 

The system moves 2 lines in advance 
to be modified. The content is 
displayed on the screen. 


Line to be Modified 

5-3 A Command Blinking Cursor 

1. Formula a n ( RETURN - 1 (n: Positive integer) 

2. Function 

The system moves n lines backwards to be modified and displays the 
content of the line. 

3. Operation 

(1) When the system is waiting for an editor command, just key in 
the number of the lines followed by "A" which you want to move. 

If you make a mistake in keying in, delete one' character by one 
by using DEL key. you can key in the new numbers again. 

(2) When you | RETURN key, the system moves n lines backwards to 

be modified. The content of the line is displayed on the screen. 
The system is waiting for another command. 

(3) The number has to be within 3 decimal digits (1 to 999). 

(4) If the input number is 1, you can omit it. 

4. Others 

If you want to move backwards beyond the beginning of your source 
program, the first line of your program becomes the one to be 
modified. . 

Example: 

The system moves 2 lines 
backwards to be modified. 

The content is displayed 
on the screen. 


Line to be Modified 


Blinking Cursor 


>14 


A A 

LDX — 

_ vvw 


D E C B 

- X Y 

: ABC 

— B N E - 


— L D A - 

- T E 

X Y 

JMP _ 

- Z Z 

:// 2 



-ABC- 

-BN E- 

— X Y 


T 


L 4 


—— A A 

mx_ 

_VVW 

_ABC- 

_DECB 

_BNE-X Y 

_DA_T E 

—— X Y 

JMP_ 

_Z Z 

/ 3 



ABC — 

B N E_ 

_X Y 

//2 



_X Y_ 

- J MP — 

_Z Z 


/_ 

T 








(30) 


RETURN 


5-4 "Space" Command 

1. Formula (Space) Characters 

2. Function 

You can add the characters after the line to be modified, 
modified line becomes the new one to be modified. 


The 


Operation 


( 1 ) 


When the system is waiting for an editor command, you can key 
in the characters followed by the SPACE key which you want to 
add. If you make a mistak e in k eying in, you can delete one 
character by one by using | DEL | key. You can key in new 
characters. . s 


(2) When you key in | RETURN | key, the system adds the characters 
after the previous line to be modified. The modified line 
becomes the new one to be modified. The system does not 
display the modified one. It is waiting for another command. 


(3) When you hit 
spaces. 


RETURN 


key after 


SPACE 


key, the system fills 


4. Others 


(1) When you apply this command after EOF, the characters are 
filled before EOF. 


Example: 

1. The characters that you want to add are keyed in, and this command 
has been executed. 

2. To make sure that this command has been executed, go backwards by A 
command, and list the content of the line by L command. 


Line to be Modified. 


/—RET 


I-RTS- 


/_ 

t 

Blinking Cursor 


Characters which have 
been added. 








(31) 


5-5 I Command 


1 . 


Formula 


I Characters 


RETURN 


2. Function 


This command inserts characters before the line to be modified. 
The previous line is still the one to be modified. 


3. Operation 


(1) When the system is waiting for an editor command, you can 
key in characters followed by j I | key which you want to 
insert. If you make a mistake in ke ying in, you can delete 
one character by one by using j DEL | key. You can key in new 
characters again. 


(2) When you hit the | RETURN 


key, the system inserts the 
characters before the line to be modified. The previous 
line is still the one to be modified. The system does not 
display the modified line. 


(4) 


When you hit 
spaces. 


RETURN 


key right after | I | , 


the system fills 


N.B. The system only allows 80 characters in one line in maximum. 

Therefore, the system only accepts 80 characters for one line. 


Example: 

1. The characters that you want to insert have been keyed in, and 
I command has been executed. 

2. To make sure that the command has been actually executed, go 
backwards by command and list the content of the line by 

L command. 


Characters to be added 


/ I R E TO-.STA-D I 

/_ 

T 

Blinking Cursor 







(32) 


5-6 K Command 

1. Formula Kn RETURN \ (n: Positive integer) 

2. Function 

This command deletes n lines including the line to be modified. • 
The next line becomes the new one to be modified, and the system 
will display the content of the present line to be modified. 

3. Operation 

(1) When the system is waiting for an edito r co mmand, you can 
key in the number.of lined followed by | K 1 key which you 
want to kill. If you want to make a mistake in key ing in, 
you can delete one character by one by using DEL key. 

You can key in new number. 

(2) When you hit the | RETURN key, the system will kill n lines 
including the line to be modified. The next line becomes the 
new one to be modified. The content of the new line to be 
modified is displayed on the screen. 

(3) The number has to be within 3 decimal digits (1 to 999). 

(4) If the number of lines is 1, you can omit it. 

4. Others 

When the number of lines to be killed exceeds the last line, the 
system will erase up to the last line. And EOF becomes the new 
line to be modified. 

Example: 

The 2 lines have been killed including the line to be modified. 

The next line will be the one to be modified, and the content of 
the new line to be modified is shown on the screen. 







(33) 


5-7 L Command 

1. Formula Ln RETURN | (n: Positive integer) 

2. Function 

This command displays the contents of the n lines including the 

line to be modified. The new line to be modified becomes the 

n + 1st line. Therefore, the new line to be modified is displayed 

on the screen. 

3. Operation 

(1) When the system is waiting for an editor co mman d, you can 
key in the number of the lines followed by j L | key which 

you want to show on the screen. If you make a mistake in_ 

keying in, you can delete one character by one by using DEL 
key. You can key in the new value. 

(2) When you key in | RETURN - key, the system displays the n lines 
on the screen including the line to be modified. The new 
line to be moved becomes the n + 1st line, and its content 

of the line is shown on the screen. The system is waiting 
for another command. 

(3) The number has to be within 3 decimal digits (1 to 999). 

(4) If the number of the line is 1, you can omit. 

(5) If the number of the lines exceeds the whole screen, the 
system cannot display at one time. If in this case the 
system displays the first 2 1 lines , the display will be 
stopped. When you hit the SPACE key, the next lines will 
be shown on the screen. When the prompt mark appears on 
the screen, this means that the file reached the end. 

(6) If the number of the lines that you want to show exceeds 
the last line, the system output up to EOF and the EOF 
Line becomes the line to be modified. 


If you want to halt the display halfway, push the 
RESET switch. If you hit the | RESET switch, the 
system returns to the BASIC mode. If you want to go 
back to the Assembler mode, type in EXEC&H5006. 

When you key in EXEC&H5006, the system is waiting 
for an editor command. • 







(34) 


Example: 

The 2 lines from the line to be modified are shown on the screen 
and the next new line is the present line to be modified. Therefore, 
the new line to be modified is displayed on the screen. 


Line to be Modified 


/ 3 


_A B C_ 

- —B N E 

-X Y 

/L 2 


_A B C_ 

-BN E 

_, L D A 

W X y 


T E 

_X Y_ 

- _ J M P 

7 7 

/_ 


mww X* 

? 

Blinking 

Cursor 





(35) 


5-8 F Command 


1 . 


Formula 


F Characters 


RETURN 


2. Function 


This command searches the same character pattern among the line to 
be modified up to the last line. If the system finds the same 
pattern in a line first time, the system understands the line as 
the new line to be modified and displays the line on the screen. 


3. Operation 


(1) When the system is waiting for an edi tor command, type in 
the character pattern followed by j F | key. If you make a 
mistake i n key ing in, you can delete one character by one 
by using | DEL 1 key. You can key in again. 


(2) When you hit | RETURN 


key, the system executes the F command 
and finds the matched line. It displays the line which 
becomes the new line to be modified. And the system is 
waiting, for another editor command. 


(3) If the system cannot find the matched line, the EOF line 

becomes the new line to be modified. The system shows the 
EOF line and is waiting for another command. 


4. Others 


When you want to search the match from the beginning of your source 
program to the end, put i in n command (This means that the line 
to be modified becomes the first line of your source program). 

And then use the F command. 

N.B. The character pattern cannot occupy the different fields. 


Example: 

The character pattern of "RTS" to be searched has been keyed in, 
and the F command has been executed. 


/FRTS 

-RETO--RTS 

/_ 

T 

Blinking Cursor 


Line to be modified 





(36) 


5-9 P Command (1) (Print Command) 


1. Formula P RETURN 


2. Function 


This command shows the line to be modified. The line to be 
modified is not moved. 


3. Operation 

(1) When the system is waiting for an editor command, key in 
P key. The system displays the line to be modified. The 
cursor is blinking at the beginning of the line to be 
modified. 


( 2 ) 


When you hit the 
another command. 



key, the system is waiting for 


Example: 

The P command has been executed. 


/P 

-RET 1-RTS 

T 

Blinking Cursor 

(When the [ RETURN - key is hit, the system 
is waiting for another command) 






(37) 


5-10 P Command (PUT Command) 

1. Formula P Characters RETURN 

2. Function 


The content of the line to be modified is modified. 

The line to be modified is not moved. 

3. Operation 

(1) When you type in | P | key during the waiting for an editor 

command, the content of the line to be modified is displayed 
on the screen, and the cursor is blinking at the beginning 
of the line. 


The modification can be made effectively by using the 
following functions of the keys. 


1) key moves the cursor right. 


2) Key moves the cursor left. 


3) When the prompt mark or [ INS | key is hit, the character 


pattern after and at the cursor position is shifted right 
in parallel and one space is inserted at the cursor 
position. 


4) 


1 DEL I key deletes one character before the cursor position 
and the character pattern after the cursor position is 
shifted left in parallel. 


5) When the other keys than those mentioned in (1) to (4), 
the character at the cursor position is replaced with the 
input character. 


(2) The above mentione d operati on can be repeated many times 


until you hit the | RETURN | key. 


(3) When you hit the 


RETURN 


key, instead of the previous line 


to be modified, the line after the modification is stored in 
the storage area of your source program. 


(4) The line to be modified is not moved. 


(5) When the number of characters in one line exceeds 80 by the 
above mentioned operations, the first 80 characters from the 
beginning are stored in the memory area of your source pro¬ 
gram. 


(1) If you want to use the prompt mark ("/") as the input 

character, replace the prompt mark with the other symbol 
by the C command. Then, input the prompt mark by the 
P command. 






(38) 


(2) When you return the cursor to the beginning and hit the 

RETURN key, the P command is neglected. If the operation 
of the P command is messed up, start from the beginning by 
using this operation. 

(3) The TAB symbol ( | CTRL | + | I | ) cannot be used under the 
P command. 



(39) 


5-11 X Command 


1. Formula X Previous Characters I PROMPT MARK New Characters I RETURN 


The prompt character is "/" under the initial condition. 


2. Function 

(1) Within the line to be modified, this command searches the 
previous characters and replaces with the new characters if 
found. The line to be modified is displayed on the screen 
after the replacement. 

(2) If the match is not found, the replacement is not executed. 
The line to be modified is not displayed on the screen. 

(3) The line to be modified is not moved. 


3. Operation 


(1) When the system is waiting for an editor command, you should 
type in the character pattern to be replaced and then the new 
character pattern after the prompt mark ("/"). 


( 2 ) 


When the | RETURN 


key is hit, 


the command is executed. 


(1) If the system has found the character pattern to be 

to be replaced, the new character pattern is replaced 
with. And the system displays the content of the line 
after the modification. 


(2) If the system cannot find the match, the replacement is 
not executed. The content of the line is not displayed, 
either. 


(3) The replacement can be executed without depending on 
the length of the character pattern to be replaced nor 
the new character pattern. But one line has to consist 
of within 80 characters. 

(4) If the system finds several character patterns in the 
same line to be modified, all of them are replaced with 
the new character pattern. 


(4) Others 

If you set one character as the character pattern to be 
modified, there is possibility that the system would find the 
character pattern at some other location where you do not 
want to replace. Therefore, it is desirable to use several 
characters as the pattern. 

N.B. The character pattern must not occupy the different 
fields. 



(40) 


Example: 

The character pattern to be replaced has been keyed in, and the 
command has been executed. 


|—“R E T 2 , R T S 

/XREf/MOD 


-MOD 2_ 

/_ 


RTS 


T 


Blinking Cursor 


Line to be modified 



5-12 Y Command 


1. Formula Y Character pattern to be. replaced | PROMPT MARK New 
Character pattern RETURN . The prompt mark is "/" under the 
initial condition. 

2. Function 

This command is executed from the line to be modified to the last 
line. Only the lines where the replacements have taken place are 
displayed on the screen. On the last line EOF is displayed. This 
EOF line becomes the new one to be modified. 

3. Operation 

(1) When the system is waiting for an editor command, type in the 
character pattern to be replaced followed by | Y | key and the 
new character pattern after the prompt mark. 

(2) When you hit the [ RETURN I key, the X command is executed from 
the line to be modified up to the last line. Among the lines 
searched, only the lines where the replacements have taken 
place are shown on the screen. If the lines are not displayed 
in one frame, the system shows the firs t one frame of the 
lines. And then if you hit the 1 SPACE 1 key, the next one 
frame of the lines will be displayed. This operation has to 
bw repeated until the prompt mark appears on the screen. 

N.B.l The character pattern cannot occupy the different fields. 

N.B.2 If y ou want to stop the execut ion of the Y command, hit 
the | RESET 1 switch. Once the RESET 1 switch is hit, the 
system returns to the BASIC mode. 

If you want to go back to the Assembler mode, execute the 
instruction of EXECSH5006. When this is executed, the 
system is waiting for an editor command. 

Example: 

The character pattern to be replaced (ABC -*• CCC) has been keyed in, 
and the Y command has been executed. 


/I 

__ORG-S A 0 

/YABC/CCC • 

_CCC-_BNE-X Y 

_____BRA-CCC 

-E 0 F 

/_ 

; r 

Blinking Cursor 







(42) 


5-13 S Command 

1. Formula 

S | " | <Device Name> : <File Name> | " | | RETURN | 

t 

File Descriptor 


2. Function 

This command saves the content of the beginning to the last line 
together with the file name on an output storage device. After 
this command has been executed, the first line becomes the new 
one to be modified. , 

3. Operation 

(1) When the system is waiting for an editor command, you can 
key in the device name and the file name consisting of 
within 8 characters after | S [ | " j keys. If you make a 
mistake i n key ing in, you can delete one character by one 
by using 1 DEL | key. You can type in new characters. 

(2) When the saving on an output storage device is finished, the 
prompt mark meaning "waiting for an editor command" is 
displayed. 

(3) As for a file name, you can use 8 characters or special 
symbols in maximum, but the file name cannot contain 
"0". or "225". 

(4) [ ” | just before the | RETURN | key cannot be omitted, because 

this editor mode is different from the BASIC mode^_The 

device name and file name have to be enclosed by | " | . 

If you omit the last | " | by mistake, the system returns to 
the BASIC mode. In this case, execute the instruction of 
EXEC &H5006 to return to this mode. 

N.B.l As for the detailed descriptors, refer to the manuals 
on Basic Master Level-3 BASIC or Basic Master Level-3 
DISK BASIC. 

N.B.2 The recording method by this editor command is binary 
just like that by "SAVEM" in BASIC language binary. 
When the file is loaded by this command, it is stored 
at the same location as the saving has taken place. 
Therefore, you have to remember the top address of 
your program. You have to designage the address 
(SOURCE TOP ADDR) when you load the program. 




(43) 


5-14 V Command 


1. Formula 


V 1 " 1 CASO 


<File Name> 


RETURN 


2. Function 


The check sum calculated by the program on the cassette tape is 
compared with the check sum result stored on the cassette tape 
when the S command is executed. At the completion of this 
command, the line to be modified moves to the beginning line. 


3. Operation 

(1) When the system is waiting for an editor command, key in 
the device name (CASO:) and the file name followed by | V I 

CD- 

(2) Cassette tape has to be re-wound before the program has been 
recorded. 


(3) The same file name as that reco rded by the S command has to 
be keyed in. When you hit the | RETURN 
begins to be executed. 


key, the V command 


(4) The cassette tape recorder has to be re-wound, and you can 
re-load your program again. 


(5) If the saving of file is correct, the V command is finished. 
The system is waiting for another editor command. 

N.B. When Basic Master Level-3 is operating under DISK BASIC, this 
V command is invalid. This command is applicable only to 
cassette tape. 



(44) 


5-15 M Command 

1. Formula 

M | " | <Device Name> : <File Name> [ " | 

File Descriptor 

2. Function 

This command merges the source program stored on an external 
storage device with the line to be modified and the lines there¬ 
after. At the completion of this command the line to be modified 
moves to the beginning -line,, 

3. Operation 

(1) When the system is waiting for an editor command, key in the 
device name and the file name consisting of within 8 characters, 
followed by | M | j 11 | . 

(2) If you make a mi stake in keying in, you can delete one character 
by one by using | DEL key. You can type in new characters. 

(3) When the merging is completed, the line to be modified becomes 
the beginning one and the system is waiting for another 
command. 

4. Others 

When you execute the M command, the source top address of your source 
program stored in the RAM memory has to be the same as that stored 
on an external storage device. 


RETURN 




(45) 


5-16 A Command 


1. Formula 


A 1 RETURN ] or A, 


RETURN 1 


2. Function 


This command converts your source program made, by the editor into 
machine codes, and outputs the assemble listing on the screen. 
Furthermore, this stores the machine codes in the RAH memory. 


When you use the command of | A | | , | | RETURN 
one frame of the listing after another. 


the system displays 


3. Operation 


(1) When t he system is w aiting for an editor command, you can 

key in | A | | RETURN . Then, the assembling is executed, and 
and the result is displayed on the screen. The system is 
waiting for another command. 


(2) When you key in | A | | , | | RETURN 

I , one frame of the listing 

is displayed. When you hit the 

SPACE | key, the next frame 


of the listing is displayed on the screen. This operation 
has to be repeated until the prompt mark appears on the 
screen. 


N.B. If you t erminate the assembling procedure halfway, hit the 
RESET switch. When this is done, the system returns to 
the BASIC mode. When you want to return to the Assembler 
mode, execute the instruction of EXEC&H5006. When this 
executed, the system is waiting for an editor command. 


Example: 

The assemble result is shown in the following format: 


001 0 2 E F BD205E 


LABEL 

L00P12 


Machine codes of If not displayed here, 
1 to 5 bytes the rest will be shown 

in the next line 
MEMORY MEMORY 

LOCATION LABEL LOCATION 

& H 4 0 1 2 L00P14 &H40EC 


* * E R R 0 R 


.COUNT-—3 


/_ : 

Blinking cursor 


No. of errors 











(46) 


5-17 AL Command 


1. Formula 


AL 


RETURN | 


2. Function 


This command outputs the assemble listing. 
3. Operation 


When the system is waiting for an editor command, you can key in 
amc RETURN I keys. The system executes the assembling of your 
source program and outputs--'the result on an printer. 


N.B. The output format by this command is the same as that by 
the A command. 


N.B. If you stop printin g the listing, hit CRTL | D | keys. When 

+ |'d | keys, the system returns to the 


CTRL 


you hit the 

BASIC mode. If you want to return to the Assembler mode, 
execute the instruction of EXEC&H5006. When this instruction 
is executed, the system is waiting for another editor command. 


N.B. The assemble listing is output on a printer having the device 
of LPTO:. 


5-18 N Command 


1. Formula 


N 


RETURN 


2. Function 


This command output the line number of the present line to be 
modified. 


Operation 


When the sys tem is waiting for an editor command, you can type in 
| N | | RETURN keys. The system outputs the line number of the 
present line to be modified, and then the system is waiting for 
another editor command. 


Example: 

The system displays the line number of the present line to be 
modified on the screen. 


Line to be modified 


_R T S 

/N 

-.2 3 

/_ 








(47) 


5-19 C Command 


1. Formula 


C 


L RETURN 

+ 


New Prompt Mark 


2. Function 

(1) This command changes the old prompt mark with the new one 
designated. This command is valid until the next change 
of the prompt mark or the re-starting of the editor. 

(2) This prompt mark means waiting for an editor command and 
is used as a space insertion code by the P command. And 
this prompt mark is used as the demarcation mark between 
character pattern by X and Y commands. 

3. Operation 


(1) When the system is waiting for an editor command, you can 
typ e in a new prompt mark (only one character) followed 

t>y [_cj 


(2) When you hit the | RETURN | key, the new prompt mark appears 
on the screen. The system is waiting for another editor 
command. 


(3) When you have loaded the Assembler, the prompt mark is "/" 


Example: 

":" has been designated as the new prompt mark by the C command 


/c : 

r 

Blinking Cursor 




(48) 


5-20 S Command 


1. Formula 


S 



2. Function 


This command displays the last address of your source program 
plus 1*. 

3. Operation 

Whe n the sys tem is waiting for an editor command, you can key in 
1 S 1 1 RETURN . The following address format is displayed on the 
screen. 


End AD = &HXXXX (in Hexadecimal digits) 

* The last address of your source program means that EOF is automatically 
added right after t he last line of your source program and that the 
memory location of RETURN for the EOF becomes the last address. 





(49) 


5-21 E Command 

1. Formula E 

2. Function 

This command returns to the BASIC mode. 

3. Operation 

(1) When the system is waiting for an editor command, you can 
key in E key. Then the system returns to the BASIC mode 
and is waiting for the BASIC command. 

5-22 Error Message 

1. Screen Format 
/W 

**ERROR (with the bell sound initiated) 

/- 

t_ Blinking Cursor 

2. Function 

When you have made a mistake in inputting an editor command, the 
error message will appear on the screen and the bell rings. 

3. Operation 

You have to input a correct editor command again. 



(50) 


6. ERROR MESSAGE OF ASSEMBLER 


During the assembling procedure, error message may appear on the screen, 
as shown in Table 6-1-1. You have to correct your source program 
according to the error messages. 

Table 6-1-1 Table of Error Messages 


ERROR DISPLAY 

CONTENT OF ERRORS 

_ 

***ERROR01 

No END- in your source program. 

* **ERROR02 

Undefined labels are found. The system insert 
$0000 value automatically. 

***ERROR03 

Labels are defined twice. The system treat the 
first label appearing in your program as valid one. 

***ERROR04 

The label table has overflowed. 

***ERROR05 

A label consists of more than 7 characters. The 
system takes the first 6 characters as legal ones. 

***ERROR06 

Illegal instructions are found. The system treat 
the op code and operand as $121212. 

***ERROR07 

An op code consists of more than 5 characters. 

***ERROR08 

No register designation in an instruction. Or 

Illegal registers are used. 

***ERROR09 

Illegal operand found. 

***ERROR10 

Relative Address Format is not applicable. The 
operand value exceeds $FF. The FCB data is of 2 
bytes. The displacement exceeds $FF. The calcula¬ 
tion result of a symbol is negative. 

* **ERR0R11 

Illegal index description. No register designation 
in an operand. Illegal registers in operands. 

* * *ERRORl2 

Illegal, value found. 





























(51) 


***ERR0R13 

Immediate instructions are not allowed. 

***ERR0R14 

No label to EQU pseudo-executable instruction. 

***ERR0R15 

Illegal usage of Forced Address Format. 


N.B. In case of ***ERROR08, the following procedures have been done by the 

system. "S" register is used for PUL and PSH instructions. "X" register 
is used for the instructions which accept X, Y, U, and S. "A" register 
is applied to the instructions which accept the other registers. 


3. DEBUGGER 

1. Concept of Debugger 

The debugger which has the file name of either DEBUG5A or DEBUG70 
is an effective tool to develop machine code programs by Basic 
Master Level-3. 

2. There are DEBUG5A and DEBUG70 Debuggers which use the different 
storage allocations. The storage and working areas of each 
Debugger are shown in Fig. 3-2-1. The memory map relationship 
of these Debuggers with the Assembler and BASIC is 'described at 
Section 2-1 in Chapter 1. Refer to this section for details. 

Figure 3-2-1 Storage Area of Debuggers 

File Name File Name 

•DEBUG5A- -DEBUG70" 












(52) 


3 Debugger Commands 

Effective Debugger commands are available to debug machine codes easily 
as shown in Figure 3-1-1. 

Table 3-1-1 Table of Debugger Commands 


CLASSIFICATION 

NO 

COMMAND 

FUNCTION 

Memory 

Reference 

and 

Modification 

1 

M 

(Memory) , 

This command refers to and modify the 
content of the designated memory location. 

By inputting special symbols, you can 
move the addresses forwards and backwards. 


2 

D 

(Display) 

The contents of 128 bytes (for the 40 
character mode) or 256 bytes (for the 80 
character mode) are displayed on the 
screen from the designated address. 

Program 

Execution 

and 

Control 

3 

B 

(Break 

Point) 

This command sets, releases, and refers 
to the break point. You can set 5 
break points at one time. 


4 

G 

(Go) 

The program will be executed from the 
designated address. When the program has 
stopped at the designated break point, 
the contents of all the registers are 
shown on the screen. 


5 

R 

(Register) 

This command refers to and modify the 
contents of registers. By using special 
symbols, you can refer to and modify the 
previous and next registers. 


6 

S 

(Step) 

One instruction by one is executed from 
the designated address (Trace Function). 
After one instruction has been executed, 
the contents of all the registers are 
displayed on the screen. 

Memory 

Block 

Transfer 

7 

C 

(Compare) 

The comparison is made between 2 memory 
ateas. If each content at a certain 
location disagrees, the system displays 
the date and address of each memory 
location in each area. 

























(53) 


Memory 

Block 

Transfer 

8 

F 

(Fill) 

• 

This command fills some designated 
data from the designated location to 
the designated location. 


9 

T 

(Transfer) 

This command transfer the contents of 
some memory area to the designated 
location and afterwards- If the two memory 
areas overlap, this command executes 
the operation. 

Others 

10 

E - 

(Escape) 

This command returns the system to the 

BASIC mode. 


11 

A 

(Assign) 

As an output device this command designates 
either of Display, Printer, or Display 
and Printer. 


Other than the Debugger commands shown in Table 3-1-1, the special keys shown below 
have the following functions: 


(1) When you type in the 1 SPACE | key, the previously keyed-in command will be 
executed. 


( 2 ) 


When you type in the | RETURN 
. command. 


key. 


the system is always waiting for a Debugger 


(3) When you type in | DEL [ key, the previously input data will be neglected. And 


the system is waiting for another data input. 


(4) When an error has taken place, the bell rings and a question mark (?) is 
displayed on the screen. 



(54) 


3-1 

M Command 



1 . 

Function 




(1) 

This command displays the content 
location. 

of 

a designated memory 


(2) 

This command modifies the content 
writes with the new contents. 

at 

a memory location and 

2. 

Operation 




(1) 

When the system is waiting for a 

Debugger command, you can 


type in the j M | command and the system is waiting for an 
address input. 

(2) When you input an address and then the I SPACE~1 key, the present 
content of the memory location is displayed on the screen. 

The system is waiting for data input. As shown below, the 
several functions are available by using special keys. 


NO 

INPUT KEYS 

FUNCTION 

1 

SPACE | 

This displays the content at the next 
memory location. 

2 

[Z3 

This displays the content at the 
previous memory location. 

3 

| RETURN | 

The system is waiting for a Debugger 
command. 

4 


The system is waiting for an address 
input shown No. 1. 

5 

<Data>* 

Any key from 

No. 1 to No. 4 

This writes new data at designated 
memory location. 


N.B.l The operations from No. 1 to No. 4 do not modify the content 
of a memory location. 

N.B.2 When you want to access the memory location where no RAM is 
mounted or when you modify the content of the ROM, no data 
is written and the question mark (?) is displayed together • 
with the bell sound. 

Address Data 

Example: The underlined part has to input. _,♦ 

c .command: ran 

a n n n p c s : x x v x .<—_• x x x x (S 





















(55) 


3-2 D Command 
1. Function 

(1) The memory contents from the designated locations thereafter 
are displayed on the screen. 


SCREEN FORMAT 

NO. OF BYTES SHOWN 

40 Character mode 

128 Bytes 

80 Character “mode 

256 Bytes 


(2) The characters are displayed on the screen according to the 
the contents of the locations. 

2. Operation 

(1) When th e sy stem is waiting for a Debugger command, you can 

key in | D | key. And the D command has been executed and the 
system is waiting for address input. 


( 2 ) 


( 3 ) 


When you type in the beginning address where the mem ory 
contents are displayed and when you type in |SPACE key. 


the system shows 8 bytes in each of 16 lines*. In case 
of the 80 character mode, the system displays 16 byte 
contents in each of the 16 lines**. At the end of the 
command, the beginning address of the next memory block is 
displayed on the screen. 


When you want to continue this operation, just type in | SPACE 
key. If you want to change the address, just type in the 
address and then SPACE key. 


(4) When you want to terminate the command, type in | RETURN | key 


N.B.l* This is applied to the 40 character mode only. 
** This is only applied to the 80 character mode. 


N.B.2 


When you hit |/\ | or HH ^y instead of the 1 SPACE ] key, 
the previous 128 bytes (256 bytes for the 80 character 
mode) are shown on the screen. 


Example: The underlines part has to be input. 


command: rn 

ADDRESS : XXX x_,- ^x x x x [S P A C El 

+. 

Address 


+ 

Address 






(56) 


3-3 B Command 

1. Function 

(1) This command sets, displays, modifies, and releases a 
break point*. 

(2) Five break points can be set at one time. 

2. Operation 

(1) When the system is waiting for a Debugger command and when 
you type in B key, the system displays the five break points 
which have been currently set. And the system is waiting 
for the first input 9 f the break point. 

(2) While the system is waiting for the address input, the 
following operations are possible by using the special keys 
shown below. 


NO 

INPUT KEYS 

FUNCTION 

1 

SPACE | 

The system shows the next break point. 

2 

CZ3 or LClJ 

The system shows the previous break 
point. 

3 

| RETURN 

The system is waiting for another 

Debugger command. 

4 


The system sets or modified a break point. 

5 

0 (Zero) | SPACE 

The system releases the break point 
already set. 


* A break point in machine language works just line the STOP statement 
in BASIC language. You can set these break points at any locations 
in order to debug your program under development. The main purpose 
is to check the contents of registers. 

N.B. When you set a break point inside one instruction, the system 
never stops there. , COMMAND 1 1 B I 

BREAK—POINT 

Example: 

1 2 3 4 5 

The underlined part has to be input. X X x x_x x x x— X X X X—X X X x— X X X X 

1 : —x xxx—- xxxx [SPACE! 

2 : —x xx x—-—x x x x [ S P A C El 

1 * * -- 

















(57) 


3-4 G Command 
1. Function 


(1) This command executes your program from the designated address 
by the G command. 

(2) When the break point has already been set, the program stops 
at this point and contents of all the registers are displayed. 


2. Operation 

(1) When the sy stem is waiting for a Debugger command and you 
type in | G | key, the G command is initiated. The system 
shows the address.of the program counter and is waiting for 
the change of the content of the program counter. 


(2) When you want to execu te your program from the displayed 

When you want to change 


address, just type in 


SPACE 


key. 


the exec ution address, key in the new address and hit the 
| SPACE key. 


N.B.l This G command does not execute the Assembler. 


N.B.2 In the following are shown the cases where your program 
execution is stopped: 

(1) In case where some break points have been set in 

your program, the G command executes up to the previous 
instruction before the break point already set. All 
the register contents are displayed. 


(2) When you hit the | BREAK | key during the program 

execution, your program execution is stopped and all 
the register contents are displayed. 


N.B.3 The program which has been s topped a t a break point is 
re-started by keying in the SPACE | key until the next 
break point is found. As shown below, the break points 
set by the B command can be skipped and you can designate 
the number of skipping the break points already set. 


U S P PC 

xxx x«x x x x— 3 fSHP A C El 

t_ 


keyed in 





(58) 


In this case, 2 break points will be skipped from the present break 
point and the program will be executed until the third break point 
point. The number you can designate is &H01 to &HFF. But this 
Debugger only accepts 5 break points. Therefore, if you designate 
more than 5, all the break points already set will be skipped. 

Example: 

The underlined part has to be input. 


COMMAND: GO 

ADDRESS : X x6(-xC-wX xxx ISPACE1 


Address 


Address 


(59) 


3-5 R Command 

1. Function 

This command displays and modifies the contents of the registers. 

2. Operation 

(1) When the system is waiting for a Debugger command and you 
have keyed in R key, the R command is executed and the 
register contents are displayed. 

(2) At the completion of displaying all the register contents, 
the system is waiting for the inout to the SP register. 

The following operations are possible: 


NO 

INPUT KEYS 

FUNCTION 

1 

SPACE | 

The next register content is shown. 

2 

CZD or [S3 

. 

The previous register content is shown. 

3 

..... - 

I RETURN 

The system is waiting for another Debugger command. 

4 

<Data*> | SPACE l 

The system writes data to the displayed register. 


* 1 byte or 2 bytes of data 
Example: 

The underlined part has to be input. 

command: nn 

SP CC A B DP IX Iy USP PC 

XXX X,—,X Xu-XXu,X X,—.X XwXXXXu.XXXXwXXX X,_iX xxx 

S P—x X x X- _x xxx jSPACEl 

C C_x x_— _x x |s PACEI 
“A-x x_- _xx fs PACEI 
— B~X x_ i _x x [S~P A C El 
D P«—x X.—i—w _x x |"S P A C El 
“ x “X X x x^-_ x xxx fs P A C El 

wY “X X x --_ x xxx Is PACEI 

'X x x x i—■ ,— . x xxx |S P A C El 
.!> C-xx x x.——.—i x xxx HTFaCEI 


















3-6 S Command 


1. Function 


(1) This command traces one instruction by one from the address 
of the program counter. 

(2) After the execution of one instruction, all the register 
contents are displayed. 

(3) Even if a break point has been set, this command executes 
one instruction by one. 

2. Operation 

(1) Before the S command, you have to change the content of the 
program counter to the beginning address from which you 
want to execute the S command. 


(2) When the system is waiting for a Debugger command and you 

type in the S eky, the S command is initiated and the system 
is waiting for the data input. 


(3) 


When you key in | SPACE | key, 


the program counter shown in 


the system shows the 

( 2 ) . 


address of 


(4) When you hit the RETURN key, the system is waiting for 


another Debugger command 


Example: 


The underlined part has to be input. 


command: nn 


S T E P—x x x x_-._ 
SP CC A B DP 

XXX X—X X —X X_XX_X X 


j— This is shown in case of 2 byte 
xx(_xxpf an instruction 


IX I Y 

-X X X X —X XXX. 


USP PC 
.XXX X_X XXX. 


IS P A C El 


N.B when you key in the SPACE key one by one, the program is 
executed one step by one, but you can skip the program 
execution designated times as shown below: 

USP PC 

xxx x_X x x X—.F^FdS ^ A^E] 

Keyed in 

In the above case, the system skips the program execution 254 
steps, and the 255th instruction is executed. The number you can 
designate is &H01 to &HFF. 





(61) 


3-7 C Command 
1. Function 


This command compares the contents of 2 memory blocks. 


2. Operation 


(1) When the sys tem is waiting for a Debugger command and you 
type in the | C 1 key, the C command is initiated and the 
system is waiting for the input of the beginning address of 
the master memory block. 


(2) When you key in the address and the | SPACE [ key, the system 
is waiting for the--end address of the master memory block. 


(3) When you key in the address and hit the I SPACE | key, the 

system is waiting for the input of the beginning address of 
the memory block to be compared. 


(4) When you key in the address and hit the | SPACE j key, the 

execution of the S command starts. If the contents of the 
2 memory blocks agree, the system is waiting for another 
Debugger command. 


(5) If the contents disagree, the system displays the addresses 

and data of each block and is waiting for another data input. 


(6) If you hit the | SPACE [ key under the condition of (5), the 

system shows the address and data afterwards when the disparity 
of data has taken place. Then, the system is waiting for 
another data input. 


(7) 


When you hit the | RETURN 


key, 


the command will be terminated. 


Example: 


The underlined part has to be input. 


COMMAND : QT] 

MASTER 


FROM-.xxxXw--. xxxx |S PACEl 
—T 0——x x x x— x xxx HTFa C E 1 
DESTIN. 

F ROM-x x x x—.-_x xxx [S PACEl 


—Display format when 
the disparity has 
taken place 


xxx x— -_x Xw : x.x x x_-_x x— ? J 
Address Data Address Data Blinking Cursor 


Master Memory 
Block 


Memory Block to 
be compared 


(62) 


3-8 F Command 

1. Function 

This command fills a constant a-t the designated locations. When 
the constant is not filled correctly*, the system displays the 
address and the content. 

2. Operation 

(1) When the sy stem is waiting for a Debugger command and you 
type in I F | key, the F command is initiated. The system is 
waiting for the input data to be filled. 

(2) When you hit the [ RETURN 1 key, the system is waiting for the 
beginning address of the memory block where you want to input 
new data. 


(3) When you type in the end address and hit the | SPACE | key, 

the F command is executed. The system is waiting for another 
Debugger command. 

* The case where data has not been filled correctly means 
that you have designated the address of no RAM or that 
you have tries to write data on ROM. 

N.B. If you wirte data in the working area of the system, the 
system goes crazy. 

Example: 

The underlined part has to be input. 


COMMAND : [T] 

DATA-X x_—_ x X [SPA C E[ 

FRO M—x x x x_-w_xxxx jSPACEi 


(63) 


3-9 T Command 

1. Function 

(1) This command transfers data from designated memory area to 
the other area. 

(2) Even if the memory addresses overlap, this command is executed. 

(3) If the memory transfer is not executed, the system displays 
the addresses and data at the original and transferred 
locations where the disparity has taken place*. 

2. Operation 

(1) When the system is wai ting for a Debugger command you type 
in the T command, the | T | command is initiated. The system 
is waiting for the beginning address of the original memory 
block. 

(2) When you type in the address and hit the SPACE key, the 
system is waiting for the end address of the original memory 
block. 

(3) When you key in the address and hit the | SPACE | key, the 
system is waiting for the input of the beginning address where 
data is transferred. 

(4) When you key in the address and hit the | SPACE key, the 
transfer is executed. At the completion of the memory 
transfer, the system is waiting for another Debugger command. 

* The case where the correct transfer has not taken place 
means that you have designated the address in no RAM or 
that you have tries to transfer to the ROM area. 

N.B. If you transfer to the working area of the system, the 
system goes crazy. 

Example: 

The underlined part has to be input. 


COMMAND : FTI 

MASTER 
F ROM-xx x x — 
0 - — x x x x_ 
D E ST I N. 

F ROM—x xxx- 





(65) 


3-10 E Command 

1. Function 

This command returns the system to the BASIC mode. 

2. Operation 

When the system is waiting for a Debugger command and type in 
the E key, this command returns the control to the BASIC mode. 

3-11 A Command 

1. Function 

As an output device, the command designates one of the following 
devices: 

(1) Display (CRT) 

(2) Printer (LPT) 

(3) Display and Printer (CRT + LPT) 

2. Operation 

(1) When the sys tem is waiting for a Debugger command and you 
type in the A key, the A command is initiated and the 
system is waiting for the designation of an output device. 

(2) When you type in the number of 1 to 3 which designates an 
output devices, the designated device becomes valid afterwards 

(3) If you want to change the designation of an output device, 
this command has to be executed again. 

N.B. When you designate Display or Display and Printer, make sure 
that a printer has been connected to the system. 

N.B. When you designate a printer, the content that has been type d 
in previously will not be printed until you hit the SPACE 
key. 

N.B. If you do not designate the output device by the A command, 
the system automatically designate CRT by default. 

N.B. The device name of a printer designated as an output device 
is LPTO: 

Example: 

The underlined part has to be input. 


COMMAND:® 

CRT=1.LPT=2. CRT + L P T = 3 : fT] or 


GO ° r CD 


( 66 ) 


4. OPERATION OF BASIC MASTER LEVEL-3 


1. Concept 

The Assembler is available either on cassette (MA-5100) or on 
diskette (MA-5200). The application of the Assembler is different 
according to the memory size of Basic Master Level-3. At the 
following sections we are going to describe the details of the 
Assembler. 

It is recommended to use the 80 character mode for the screen of 
MB-6890, which makes it easy to read the assembled list on the 
screen. 

2. Operation of MA-5100 (Cassette Tape) 

2-1 Re-Saving of the Assembler 

The Assembler is recorded on cassette tape under the file name of 
"ASM9" as shown in figure 4-2-1. The Debuggers are recorded under 
the file names of "DEBUG70" and "DEBUG5A". DEBUG70 is stored 
at the memory locations of SH7000 to &H7FFF. DEBUG5A is stored 
at the memory locations of SH5A00 to &H69FF. For cassette-based 
system, DEBUG70 has to be used. 


Beginning of Tape 


"ASM9" 

"DEBUG70" 

”DEBUG5A" 

CASSETTE TAPE 


Figure 4-2-1 File Organisation of Cassette Tape 

According to the following procedures, these programs are re¬ 
recorded on another cassette tape and it is recommended to use 
the re-recorded tape. The original one should be kept as master 
tape. 

(1) A cassette tape recorder should be connected to Basic Master 
Level-3 and the cassette tape, MA-5100, should be installed. 

You can load the program under the file name of "ASM9" by using 
the BASIC command. 

Example: 


Ready 

LOADNi 'ASM 9’ I RETURN 1 

Searching *— The tape recorder has to be under playing 

position 

Found: ASM 9 

Ready 

t_ 


Blinking Cursor 



(67) 


The Debugger can be loaded under the file name of "DEBUG70". 

(2) Another cassette tape has to be installed in the cassette 
player, and you can save the program on this tape by using 
the BASIC command. 

Example: 

Ready 

SAVEM ‘AS M9“, &H5000. &H69FF &H5Q00 I RETURN] 

Ready 

N.B. Before you hit the RETURN key, you have to push the 
"Record"- button and start the recorder. 

When the saving of the Assembler is finished, give the following 
command: 

SAVEM ‘ D E B U G70\ &H7000. &H7F F F, &H7000 I RETURN! 


■ This command saves the Debugger on the tape. 

From now on, you can use re-saved tape. 

2-2 Loading of Assembler and Debugger 

You can load the program of the Assembler and Debugger in Basic 
Master Level-3 from the re-saved tape. 

(1) Install the tape mentioned before in a tape recorder. 

(2) Reserve the memory area for the machine codes by using the 
BASIC command. 

Example: 

CLEAR300, &H4E F F I RETURN ] 

&H4EFF Do not use the address greater than &H4EFF 


N.B. When you expand the memory area up to 40KB and use the MA-5100, 
There is no need to reserve the memory area of the object 
program by using the BASIC command. When you use the CLEAR 
command, refer to Section 2-1 in Chapter 1 (Memory Map). 


( 68 ) 


(3) The Assembler will be loaded by the LOADM in the BASIC language. 
Example: 

Ready 

LOADM "AS M9" 1 RETURN] 

Searching *” The tape recorder has to be set 

to the playing position 

Found' ASM 9 
Ready 

Blinking Cursor 


(4) You can load the Debugger under the file name of "DEBUG70" in 
the same way as the Assembler. If you do not want to use the 
Debugger, there is no need to load it. If you do not use the 
Debugger, the area allocated for the Debugger can be used for 
that for your source program or its object program. 

N.B. When you switch off the machine, the Assembler or Debugger 
disappears. Every time when you switch on the machine, 
you have to load them. 

N.B. When the object program is destroyed and you run the 
program, the Assembler or Debugger will be destroyed. 

In this case, re-load them again. 

2-3 Execution of Assembler 

(1) You can start the assembler from the beginning address by the 
EXEC command in the BASIC language as shown in Table 4-2-1. 

Table 4-2-1 


EXECUTION METHOD 

STARTING ADDRESS 

NORMAL START 

&H5000 

1. Re-start after the E command in the Editor 

2. Re-Start after the RESET | 

3. Re-Start after | CTRL | + | D 

&H5006 

LOADM"ASM9", ,R RETURN | 

(SH5000) 


In case of.the re-starting the Assembler, the system is waiting for an 
editor command.* In case of L0ADM"ASM9",, R, the Assembler is initiated. 
This is the same with the normal start. The normal start is shown in the 
following example: 



(69) 


Example: 


Ready 

E X E C & H 5000 I RETURN 1 

* A SMB/ED I TR-V2.0 
NEW/RAM/EXTM ? _ 

Blinking Cursor 

N.B. By using the G command in the Monitor, the Assembler can be 

- initiated. But by using the same command, you can not initiate 
the Debugger. '~" J 

(2) Input Deisgnation of Source Program 

As input methods of your source program, there are 3 kinds. By 
by inputting one character as shown below, you can choose one of 
of them. 

( 1 ) 


( 2 ) 


( 3 ) 


♦ PROGRAM NAME : C ASO EXAMPLE fRETURN I (y oucan 
designate the device name as (*). 

(3) Designation of the Memory Address of Source Program 

In reference to the Memory Map describes at Section 2-1 in Chapter 1, 
you can decide on the starting address of your source program in the 
RAM and input the address in Rex. 


The case where you input your source program through the 
keyboard: 


: NEW/ra,V|/EXTM’| 
/SOURCE TOP A D D R ? 


L 


Blinking Cursor 


The case where your source program is already in the RAM: 
: NEW/RAM/ EXTM’Hl 


/ 


L_ 


Blinkina Cursor 


The case where your source program is loaded from the 
cassette tape: 

:new/ram/extm 7 © 

/SOURCE TOP ADDR 7 _ 

(Input the top address f . 

of your source program) Blinking Cursor 

PROGRAM NAME: EXAMPLE * 

(Program name to be L. 

.loaded) 


RETURN 

Input the file name of within 


Blinking Cursor 


8 characters, and start the tape 
recorder 


(70) 


If you input more than 4 digist, the last 4 digits will be accepted. 
When you input the memory location lower than the beginning address of 
the user's RAM, the system is waiting for another address input. 

Example: 

* ASMB/'ED I TR-V2.0 

: new/ram/extm ?[n] 

'SOURCE TOP A D D R ’ 3000 
Blinking Cursor 



N.B.l If you designate tha_top address of the user's RAM as the 
beginning address of your source program and execute the 
BASIC commands under the BASIC mode, there is possibility 
that your source program will be destroyed. In this case, 
it is recommended to designate the beginning address as user's 
beginning address of the RAM plus &H100. 

N.B.2 When you load your source program saved on cassette, you have 
to designate the same address as you have saved it on tape. 

If both addresses are different, the program will not be 
loaded correctly. 

2-4 Execution of Assembler 


(1) When you have finished the editing of your source program by 
the Editor, type in the A command. 



(2) If the listing exceeds one frame of the screen, the system 
shows the first fr ame of th e listing. After checking the 
list, type in the I RETURN - key. 


When the number of errors and the prompt mark appear on the 
screen, that is the end of the listing. 


The object program is stored in the RAM according to the ORG 
instruction. Therefore, you can execute the program right 
away*. 


If some errors are found, you can modify your program under 
the Editor. 



(71) 


(3) If you want to assemble your source program saved on cassette 
tape, you have to follows the same procedures mentioned above. 

(4) If you want to output the assemble listing on a printer, you 
have to connect the printer to the system and give the AL 
command. 


Example: 


/AL | RETURN 


If you want to sto p print in g h alfway, just type in 


CTRL 


CRT 


keys, the system returns to 




keys. If you hit 
the BASIC mode. To return to the Assembler mode, execute the 
command of EXEC&HS006 'in the BASIC language. The system will 
return to the Assembler mode and is waiting for an editor 
command. 


N.B. The assembled listing is output on a printer which has 
the device name of LPTP: 


(5) The errors which have happened during the assembling procedures 
are represented by the numbers shown in Table 2-6-1 in 
Chapter 2. And the assembling procedures will be continued 
under the conditions shown there. 

(6) To execute your object program, you have to execute an 
instruction of EXEC after you have returned to the BASIC mode 
by the E command in the Editor. 

Example: 

/E EXECSHXXXX [ RETURN j 

Or you can execute your object program by the G command in 
the Monitor. 


Example: (After you have returned to Monitor mode) 


*GXXXX | RETURN | 


N.B. The memory locations of &H400 to &H43FF are used for a 
colour display unit. If you use this memory area for 
the storage of your object program or the stack, the 
colour of a monitor will be affected. When you use this 
memory area for the storage of your object program, you 
have to bare this fact in mind. 

2-5 Operation of Debugger 


(1) Start from the address of &H7000 by the instruction of EXEC 
in the BASIC language. 

Example: Ready _ 

E X E C & H 7000 fRETUlTN ] 

(The screen will be cleared) 

DEBUGGER VI.0 ** 

' \ , n . " ■ Waiting for a Debugger command 



(72) 


(2) The Debugger will be initiated by the G command in the Monitor. 

Example: (After you are in the Monitor mode) 

*G7° 00 | RETURN 

(3) You can also initiate by LOADM,,R command in the BASIC just 
like the Assembler. 

Example: 

LOADM M DEBUG70",,R | RETURN ] 

In this case the Debugger will be initiated after the DEBUG70 
has been loaded. 



(73) 


3. OPERATION OF MA-5200 (DISKETTE) 

3-1 Operation of MA-5300 (32K DISK BASIC) 

3-1-1 Resaving of Diskette 

On the diskette MA-5200, the Assembler is saved under the file name of 
ASM9 and the Debugger is saved under the file names of DEBUG5A and 
DEBUG70. The DEBUG5A is loaded in &H5A00 to &H69FF in the RAM and the 
DEBUG70 is loaded at &H7Q00 to &H7FFF. The DEBUG70 overlaps the memory 
area with 32KB DISK BASIC. Therefore, this cannot be used. You have 
to use DEBUG5A. According to the following procedures, it is 
recommended to resave the programs on another diskette and to use it 
all the time. You should keep the original diskette as a master 
program file. 

(1) After you have initiated the DISK BASIC (MA-5300), insert 
the diskette, MA-5200, into the Drive 1 of the mini floppy 
disk unit and another blank one into the Drive 0. By using 
the BASIC command, load the Assembler under the file name of 
ASM9. 

Example: 

Ready 

loadm " i : aSM9" ( 'RETURN] 

Ready 

^— Blinking Cursor 

N.B. In order not to destory MA-5200 by mistake, make sure 

that the write protection seal is stuck on the diskette. 

(2) Then save the Assembler on the diskette in the Drive 0. 

R e a (I y 

S A V K M ' 0 : A S M9", &H5000. N:H69'FF. <i.H5000 RETURN, 

Ready 

N.B. The write protection seal on the diskette in the 
Drive 0 should be taken out beforehand. 

(3) After the above-mentioned operation, load DEBUG5A from the 
MA-5200. 

Example: 


R r a d y 

I.OAU.M *1 ; DEBUG 5 A" f RETURN i ' 
R ,• a d y 


*- Blinking Cursor 


(74) 


(4) 


3-1-2 


Save the program on the diskette in the Drive 0. 
Example: 

Ready 

S A V E M "0 : DEBUG5A", &H5A00, &H69FF, &HFA00 


RETURN 1 


After the saving, stick the write protection seal. 

Loading of Assembler 

Load the Assembler into Basic Master Level-3 from the resaved 
diskette. 


(1) Initiate 32KB DISK BASIC. 

(2) Insert the resaved diskette into the mini floppy disk 
unit. 

(3) You have to reserve the memory area for the object program 
by using the CLEAR command in the BASIC language. 

Example: 


CLEAR 300, &H4EFF 


RETURN 


The address should not be greater than SH4EFF. 

(4) The Assembler is loaded by the LOADM command in the BASIC. 
Example: 

Ready 


L O A D M "1 : ASM9" [ RETURN | This is applicable when the 

diskette in the Drive 1 


Ready 


t_ Blinking Cursor 




(75) 


3-1-3 Operation of Assembler 

(1) You have to start from the address shown in Table 4-3-1 by the 
EXEC command in the BASIC. 

Table 4-3-1 Beginning Address of Assembler 


STARTING METHOD 

STARTING ADDRESS 

NORMAL START 

&H5000 

1. Re-start after the E- command in the Editor 

&H5006 

2. Re-start after the | RESET | 

3. Re-start after | CTRL | + | D | 

LOADM"DEVICE NAME* : ASM9",,R RETURN | 

(&H5000) 


* As for the device names, refer to the manuals on BASIC Master Level-3 ROM 
BASIC or DISK BASIC. 


In case of the re-start mentioned above, the system is waiting for an 
editor command. In case of using LOADM,,R command, the Assembler is 
initiated after the loading, which is exactly the same with the normal 
start. The normal start is shown in the following: 

Example: 

Ready 

EXEC&H5000 | RETURN 
(The screen will be cleared) 

* ASMB/EDITR_V2.0 ' 

:NEW/RAM/EXTM ? 

1 Blinking Cursor 

N.B. You can initiate the Assembler from the start address shown in 

Table 4-3-1 by using the G command in the Monitor. But you cannot 
initiate the Assembler by the G command in the Debugger. 

(2) Input Designation of Source Program 

As input methods of your source programs, there are 3 ways. You can 
designate one of them by inputting one character in the following: 

(1) The case where your source program is input through the 
keyboard: 

': NEW/RAM/EXTM? | N | 

-/SOURCE TOP ADDR? ' 








(76) 


(2) The case where the program is in the RAM: 

:NEW/RAM/EXTM?' R 

/ _ 

+ Blinking Cursor 


(3) The case where the program is loaded from the diskette:' 


:NEW/RAM/EXTM? E 
/SOURCE TOP ADDR ? 


(Input the top t_ Blinking Cursor 

address of your 
source program) 


PROGRAM NAME: 1-tEXAMPLE 


RETURN 


(Program Name 
to be loaded) 


(This is the case where the 
diskette is inserted into Drive 1) 


/ 


Device Name and 
File Name of within 
8 Characters 




Blinking Cursor 


N.B. There are no need of the double quotation marks before and 
after the device najme and file name. 


(4) The case where the program is loaded from the cassette tape: 


:NEW/RAM/EXTM? E 
/SOURCE TOP ADDR? 


t. Blinking Cursor 


(Input the top address of your source program) 
PROGRAM NAME:CASO:EXAMPLE 


RETURN 


~ Device name CASO: of the cassette tape 
and the file name of within 8 characters 
have to be input, and start the tape recorder. 
(Program to be loaded) 

/ _ 

+_ Blinking Cursor 

N.B. The double quotation marks are not needed before and aftter 
the device name and file name of within 8 characters. 


(3) Designation of Beginning Address of Source Program RAM 

In reference to the Memory Map at Section 2-1 in Chapter 1, you have to 
decide on the beginning address of your source program in the RAM area, 
and to input the address in Hex. If you input more than 4 digits, the 
last 4 digits will be accepted. And if you input the address lower than 
the beginning address of user's RAM, the system is waiting for another 
input. 

Example: *ASMB/EDITR V2.0 

: NEW/RAM/EXTM? N 
< /SOURCE TOP ADDR? 3000 [ RETURN 
’/ * 



(77) 


N.B. When you designate the beginning address of user's RAM as the 
top address of your source program and execute the commands 
in the BASIC language, there is possibility that your source 
program might be destroyed. It is recommended to designate 
the address as the beginning address of user's RAM plus 
&H100 or thereafter. 

N.B. When you load programs from the diskette, you have to use the 
same address as it has been saved. If the addresses disagree, 
the program will not be loaded correctly. This is the same 
with the cassette tape. 

3-1-4 Execution of Assembler 


(1) When you have finished the editing of your source program by 
editor commands, input the A command. 

Example: /A [ RETURN 

<The assembled listing is displayed on the screen) 
or 

/A, 1 RETURN | 


(2) When you type in A, I RETURN 


only one frame of the listing 
is displ ayed on the screen. After checking the list, just 
type in | RETURN | key. When the number of errors and the 
prompt mark are displayed on the screen, the listing has been 
completed. The object program is stored in the RAM at the 
designated locations by the ORG instruction. You can execute 
your program right away. If you have found some errors, you 
can modify immediately by the editor commands. 


(3) If you want to assemble your source program on the diskette, 
you can execute the A command in the same way as mentioned 
before. 


(4) If you want to print the assemble listing on a printer, use 
the AL command. Make sure that the printer is connected to 
the machine. 


Example: /AL 1 RETURN 


If you wa nt to stop printing half way, g ive the command 
| CTRL 1 + I D 1 . When you type in | CTRL + 1 D | , the system 


returns to the BASIC mode. If you give the command of EXEC&H5006 
the system returns to the Assembler mode. And the system is 
waiting for an editor command. 


N.B. The listing will be printed on the printer with the device 
name of LPTO:. 


(5) When errors have taken place during the assembling procedures, 
the type of an error is shown in number shown in Table 2-6-1. 

The assembling will be continued under the conditions shown there 

(6) To execute your object program, return to the BASIC mode by the 

E command in the BASIC and execute the instructiog of the EXEC 
command. ~—- 





(78) 


Example: 


/E 

EXEC&HLXXXX 


RETURN 


OR you can execute the object program by the G command in the 
Monitor. 


Example: (In the Monitor mode) 

*GXXXX | RETURN | 

N.B. The program for the colour display monitor is stored 

at the memory locations of &H400 to &H43FF. If you use 
these memory area for the storage of your object program 
or for the stack operation, the colour of the monitor 
will be affected. You have to bear this fact in mind. 

3-1-5 Loading of Debugger (DEBUG5A) 

The purpose of this Debugger is to debug the machine codes of your 
source program made from your source program. When you debug the 
object program on the machine code level, you have to load DEBUG5A 
from the resaved diskette as mentioned in 3-1-1. 

(1) There is no need to execute the CLEAR command in the BASIC, 
because the storage area for the object program is already 
reserved. Only when you want to use the Assembler, you have 
to set the storage area of the object program by using the 
CLEAR command in the BASIC. See the example below: 


Example: CLEAR300, &H59FF I RETURN 

t_ 

Do not designate the address greater 
than &H59FF. 


(2) The Debugger is loaded by the LOADM command in the BASIC. 

Example: Ready 

LOAD M"1:DEBUG5A" 1 RETURN 1 This is the case where 

the resaved diskette 

R e a ^ is inserted in the Drive 1 

t_ Blinking Cursor 

Because the storage area for the Assembler is from &H5000 to 
&H6FFF and that for the Debugger is from SH5A00 to &H69FF, 
the Assembler will be destroyed if the Debugger loaded. But 
the source program and the object program will not be destroyed. 
Therefore, if you reload the Assembler, you can modify your 
source program by using editor commands. 

N.B. DEBUG70 cannot by used because the storage area for 

32KB DISK BASIC overlaps with that for the Assembler. 




3-1-6 Operation of Debugger (DEBUG5A) 


(1) The Debugger which has been loaded in the above method can 

be started from &H5A00 by using the EXEC command in the BASIC. 


Example: Ready 

EXEC&H5A00 1 RETURN ] 

(The screen will be cleared) 

** DEBUGGER VI.0 ** 

COMMAND 

t. Blinking Cursor 

(2) This can be operated by the G command in the Monitor 
Example: (In the Monitor mode) 


*G5A00 


RETURN 1 


(3) The LOADM,,R command in the BASIC can initiate the Debugger 
as in the Assembler. 


Example: L0ADM"DEBUG5A",,R [ RETURN | 

In this case the Debugger will be initiated right after 
DEBUG5A has been loaded. 

3-2 Operation of MA-5301 (40KB DISK BASIC) 


3-2-1 Resaving of the Program 

On diskette MA-5200, the Assembler is saved under the file name of 
ASM9 and the Debuggers are under the file names of DEBUG5A and 
DEBUG70. DEBUG5A is stored at the memory locations of &H5A00 to 
&H69FF and DEBUG70 is stored at the locations of &H7000 to &H7FFF. 

You have to use the DEBUG70 here. Normally, you have to resave these 
programs on another diskette according to the following procedures. 

It is recommended to use the resaved one. The original one should 
be kept as a master diskette. 

(1) After the DISK BASIC (MA-5301) has been loaded, insert the 
diskette, MA-5200, into the Drive 1 and another diskette 
in the Drive 0. Load the Assembler under the file name of 
ASM9 by using the BASIC command. 

Example: Ready 

LOAD M"1:ASM9" | RETURN | 

Ready 


t_ Blinking Cursor 



(80) 


N.B. In order not to destroy the diskette, MA-5200, make 

sure that the protection seal is stuck on the diskette. 

(2) Load the Debugger under the file name of DEBUG70 in the same 
way as mentioned above. 

(3) Resave these programs on another diskette inserted into the 
Drive 0. 


Example: 


Ready 

SAVE M"0:DEBUG70", 
Ready 


&H7000, &H7FFF, &H7000 


RETURN | 


t. Blinking Cursor 

N.B. After saving these programs, stick the write protection 
seal on the diskette. 

3-2-2 Loading of Assembler and Debugger 

Load the Assembler and Debugger into Basic Master Level-3 from the 
diskette saved in the above-mentioned method. 

(1) Load 40KB DISK BASIC (MA-5301) 

(2) The resaved diskette has to be inserted into the Drive. 

(3) The Assembler is loaded by the LOADM command in the BASIC. 

Example: Ready 

LOAD M"1:ASM9" [ RETURN 1 
Ready 

t_ Blinking Cursor 

(4) The Debugger under the file name of DEBUG70 is loaded in the 
same way as in the Assembler. If you do not want to use 
the Debugger, there is no need to load it. If you do not 
load the Debugger, the area for the Debugger can be used for 
the storage area for your source program or object program. 

N.B. In case of using MA-5301 (40KB DISK BASIC), there is no 
need to reserve the memory area for the object program 
by the CLEAR command in the BASIC in order to store the 
Assembler or Debugger. In order to execute the CLEAR 
command, refer to Memory Map at Section 2-1 Chapter 1. 


This is the case where the 
diskette is inserted into 
the Drive 1. 




(81) 


3-2-3 Operation of Assembler 

(1) Start the Assembler from the address shown in Table 4-3-2 by 
using the EXEC command in the BASIC. 

Table 4-3-2 


STARTING METHOD 

STARTING ADDRESS 

NORMAL START 

&H5000 

1. Re-start after the E command execution in the Editor. 

2. Re-start after the | RESET | . 

3. Re-start after CTRL | + | D | 

&H5006 

LOADM"DEVICE NAME*:ASM9",,R | RETURN | 

(&H5000) 


* As for the device names refer to the manuals on Basic Master Level-3 
ROM BASIC or DISK BASIC. 

In case of the re-start, the system is waiting for an editor command. 
When you use LOADM,,R command, the system is in the Assembler mode. 
This is the same with the normal start. The example of the normal 
start is shown in the following: 

Example: Ready 

EXEC&H5000 1 RETURN 

(The screen will be cleared) 

* ASMB/EDITR_V2.O 

:NEW/RAM/EXTM? 

t. Blinking Cursor 

N.B. By using the G command in the Monitor, the Assembler 
will be initiated from the starting address shown in 
Table 4-3-2. This is not applied by the G command in 
the Debugger. 

(2) Input Designation of Source Program 

There are 3 methods to input your source program in the RAM. 
By inputting one character shown below, you can designate 
the input of your source prdgram. 

(1) The case where your source program is input through the 
keyboard: 

:NEW/RAM/EXTM? j N ) 

/SOURCE TOP ADDR? 

t_ Blinking Cursor 














(82) 


(2) The case where your source program is in the RAM: 

:NEW/RAM/EXTM? [ R ! 

/ _ 

t. Blinking Cursor 


(3) The case where your source program is on the 
Diskette: 


:NEW/RAM/EXTM? | E | 
/SOURCE TOP ADDR? 
(Input the top 
address of your 
source program) 


Blinking Cursor 


PROGRAM NAME: 1:EXAMPLE | RETURN [ This is the case where the 
t. The device name [diskette is inserted into 
and the file name~| the D rive 1. 
of within 8 characters.I 
Program to be loaded 
/ _ 

t_ Blinking Cursor 


N.B. The double quotation marks are not needed before nad 
after the device name and the file name of within 
8 characters. 


(4) The case where the program is stored on cassette tape: 

: NEW/RAM/EXTM? |~E~| 

/SOURCE TOP ADDR? 

t_ Blinking Cursor 

(Input the top address of your source program) 


PROGRAM NAME:CASO:EXAMPLE 


RETURN 


t_ Input the Device name CASO: of the 
cassette and the file name of the 
cassette and start the tape recorder. 
(Program to be loaded) 

/ 


t_ Blinking Cursor 


N.B. The double quotation marks are not needed before and 
after the device name and the file name of within 
8 characters. 

(3) Designation of Beginning Address'of Source Program 

In reference to Memory Map at Section 2-1 in Chapter 1, you have to 
decide on the beginning address of your source program in the RAM, and 
to input the address in Hex. If you input morS” than 4 digits,' the last 
4 digits will be effective. And if you designate the address, lower 
than the beginning address of user's RAM, the system is waiting for 
another -input. . • 


(83) 


Example: *ASMB/EDITR_ V2 .0 

:NEW/RAM/EXTM? | N | 

/SOURCE TOP ADDR? 3000 | RETURN 

/ _ 

t_ Blinking Cursor 

N.B.l When you designate the beginning address of user's RAM as. 
the beginning address of your source program and execute 
the BASIC commands in the BASIC mode, there is possibility 
that your source program might be destroyed. Therefore, 
it is recommended to designate the starting address of 
your source program at the beginning address of user's RAM 
plus &H100 and thereafter. 

N.B.2 When you load your-source program stored on the diskette, 
you have to designate the same address which is stored on 
the diskette. If the two addresses are different, the 
program will not be loaded correctly. This is the same in 
case of the cassette tape. 

3-2-4 Execution of Assembler 


(1) As soon as you have finished the editing of your source program, 
input the A command. 


Example: 


/A 


RETURN 


(The listing will appear on the screen) 


or 


/A, 


RETURN 1 


( 2 ) 


RETURN 


only one frame of listing 


When you input the A, 
will be displayed. If you hit the SPACE key, the next frame 
of the listing appears on the screen. 


When the number of errors and the prompt mark appear on the 
screen, this means that the assembling has been completed. 
Your object program is already stored in the RAM according 
to the ORG instruction designated by a user. Therefore, 
you can execute the program right away. If some errors 
are found, you can modify the source program by the editor 
commands. 


(3) If you want to assemble the source program already stored on 
diskette, execute the A command as mentioned before. 

(4) If you want to make the assemble listing, connect the printer 
to the machine, and input the AL command. 


Example: /AL j RETURN j 





(84) 


If you want to stop prin ting ha lf way , type in [ CTRL | + j D | 


keys. When you hit the CTRL + | D 1 keys, the system 


returns to the BASIC mode. When you execute EXEC&H5006, 
the system returns to the Assembler mode. The system is 
waiting for an editor commands. 


N.B. The listing will he output on the printer under the 
device name of LPTO: 


(5) The errors which have occurred during the assembling procedures 
are shown in number represented in Table 2-6-1. The assembling 
is continued under the conditions shown there. 


(6) In order to execute the object program, return to the BASIC 
mode by using the E'dommand in the Editor and execute the 
EXEC instruction. 


Example: /E _ 

EXEC&HXXXX [ RETURN 


Or you can execute the object program by the G command in 
the Monitor. 

Example: (In the Monitor mode) 


*GXXXX 1 RETURN 

N.B. The program for a colour display monitor is stored at 
the memory locations of &H400 to &H43FF. If you use 
this memory area for the storage of your object program 
stack memory storage, the colour of the monitor will 
be affected. When you store your object program in 
this area, you have to bare this fact in mind. 

3-2-5 Operation of Debugger (DEBUG70) 

(1) Start the Debugger from the address of &H7000 by using the 
EXEC command in the BASIC. 

Example: Ready 

EXEC&H7000 | RETURN ] 

(The screen will be cleared) 

** DEBUGGER Vl.O ** 

COMMAND: 

t_ Blinking Cursor 

(2) This will be initiated by the G command in the Monitor 

Example: (In the Monitor Mode) 

*G7000 | RETURN [ 

(3) LOADM,,R command initiates this Debugger in the BASIC mode, 

just as in the Assembler. • ’ • 


Example: LOADM"D£BUG70",,R | RETURN 1 





(85) 


In this case, the Debugger will be initiated right after 
DEBUG70 has been loaded. 


SUPPLEMENTARY 

Even if you use the Assembler (MA-5200) together with 40KB DISK 
BASIC (MA-5301), it is possible to use DEBUG5A. If you load DEBUG5A 
in the RAM in this case, ASM9 will be destroyed. And if you load 
ASM9, DEBUG5A will be destroyed. Therefore, ASM9 and DEBUG5A have 
to be loaded according to your needs. Instead, the memory area which 
is occupied by DEBUG5A (&H7000 to &H7FFF), can be used for the storage 
of your source program or object program. 


( 86 ) 


4 Simultaneous Development of Assembly and BASIC languages 
4-1 Usage of Memory Area 

(1) RAM Area Available to User 

When you load the Assembler and Debugger in the RAM, the 
area available to a user is shown in Figure 1-2-1 at 
Section 2-1 in Chapter 1. A user has to make BASIC and 
Assembly programs and further their object programs in this 
memory area. 

(2) Setting of Screen Format 

When the system is'equipped with the standard 32KB RAM 
and is used as the 80 character high-resolution screen 
format, the available memory area to a user for Level-3 
BASIC and Level-3 DISK BASIC (memory location from the 
beginning of user's RAM up to the previous one byte of the 
Assembler working area) is 1944 bytes and 910 bytes, 
respectively. Therefore, it is very difficult to store 
BASIC and Assembly programs and their object programs in 
this area. In this case it is recommended to use the 40 
character screen format, in order to use as many available 
locations as possible. 

(3) Setting of Upper Address for BASIC 

When the system is equipped with the standard 32KB RAM, 
you have to reserve the memory area for object program 
by using the CLEAR command in the BASIC. 

(4) Effective Usage of RAM Area by Use of DEBUG5A 

When you use a cassette tape recorder as an I/O device or 
40KB DISK BASIC, it is quite possible to use DEBUG5A. 

When you use DEBUG5A and Assembler alternately, you can 
use more memory locations than DEBUG70 is used. 

But, when you use a cassette tape recorder, it takes a long 
time to load DEBUG5A and Assembler. 

(5) Others 

In reference to Memory Map at Section 2-1 in Chapter 1, 
you can avail yourself of the machine in clever ways. 



67 . 


4-2. Development Procedure 


Restart from &K5000 
by the EXEC Command 





Initiation 
of Assembler 





s 


Reserves the memory areas for 
Assembler and Debugger and 
sets the upper address for the 
BaSIC 

Concerning BaSIC and Assembly 
programs, the minimum BASIC 
main program is needed which 
calls subroutines and Assembly 
programs. 

l)*Use the command of PRINT 
FRE(O) to find the unused 
memory size. Decide the 
top addresse of Assembly 
program 

d.) Start from &H5000 by the 
EXEC command. 


l)Input Designation 
:NEW/RAM/EXTM? 

d.) Designation of Top Address 
/SOURCE TOP ADDR ? 


Bugs in 

Assembly 

Program 



♦The area for BASIC constants and 
that for the stack are not reserved 
if you do not run the program. 

Bear this in mind. 







( 88 ) 


5. Assembly Language 

1. Introduction 

In this chapter we are going to describe the Assembly Language which 
is used for Microprocessor HD6809 of Basic Master Level-3, MB-6890. 

At Section 2 the addressing formats are describes and at Section 3 
the instructions are described. 

2. Address Format 

There are 8 address formats as shown in the following: 

1) Implied Address FormaJ 

2) Accumulator Address Format 

3) Immediate Address Format 

4) Direct Address Format 

5) Extended Address Format (Including extended indirect address 
format) 

6) Register Address Format 

7) Indexed Address Format 

(1) Constant offset index address format 

(2) Constant offset index indirect address format 

(3) Accumulator index address format 

(4) Accumulator index indirect address format 

(5) Auto-increment address format 

(6) Auto-increment indirect address format 

(7) Auto-decrement address format 

(8) Auto-decrement indirect address format 

8) Relative Address Format 

(1) Short/Long relative address format 

(2) Program counter relative address format 


(89) 


2-1 Implied Address Format 

This is an address format in which the field to be operated is clear 
from an instruction. Therefore, an operand is not needed as follows: 

Example: MUL. SEX 

2-2 Accumulator Address Format 

This is an address format in which an accumulator is operated by an 
instruction. You can designate Accumulator A or B as an operand of 
one byte. This Assembler does not allow to intert a space between the 
mnemonic code and the register name. 

Example: DECA or DECB 

TSTA or TSTB 

2-3 Immediate Address Format 

In this case, an operand itself becomes data. This format needs 
"#" at the beginning of an operand. After the "#", you have to 
write decimal, hexadecimal and binary numbers, and a label or an 
expression which is replaced by a number during the assembling 
procedures. As an immediate value, an instruction concerning 
8-bit operation takes the value of -128 to 255, and an instruction 
concerning a 16-bit operation takes the value of -32768 to 65535. 

Example: 


STATEMENT 

MACHINE CODE 

FIRST BYTE 

SECOND BYTE 

THIRD BYTE 

,LDA#25 

86 

19 


LDX#&H4B01 

8E 

4B 

01 

LDD3100+600 

CC 

02 

BC 

LDA#-1 

86 

FF 



In Figure 5-2-1 is shown the data flow in immediate address format 



Figure 5-2-1 Data Flow In Immediate Address Format 
















(90) 


2-4 Direct Address Format 

This is address format which decide an effective address as the higher 
address byte from the direct page register and the lower address byte 
from an operand. When an operand denotes an address and the higher 
byte agrees with the direct page pseudo register, the Assembler selects 
direct address format and the lower byte as an operand. Otherwise, 
the Assembler selects automatically extended address format. 

Or not concerning with the content of direct page pseudo register, 
the Assembler designates direct address format (forced direct address 
format). In this case, you have to add "<" at the beginning of an 
operand. When the higher byte disagrees with the content of direct 
page pseudo register and the forced direct address format is designated, 
this Assembler gives an error yarning to give a user some attention 
when your program is assembled. The direct page pseudo register is 
to remember the address of a page consisting of 256 bytes as one page, 
thus covering the address space from &H0000 to &HFFFF. 


Page 

Address 


S00 
$01 ^ 
$02 
$03 


$ FF 


Address 



—r* 

256 Bytes 

__L_ 


Figure 5-2-2 Relationship Between Page and Address Space 


Figure 5-2-2 shows the range of direct address which can be designated 
by each page address. For example, if the page address is 1 which means 
that the content of direct address register is &H01, the direct address 
format can access to the memory locations of &H0100 to &H01FF. 




address format 


ess format, an operand value becomes an effective 
here direct address format is selected, it can 
by putting ">" at the beginning of an operand. 
















(92) 


Example: 


STATEMENT 

MACHINE CODE 

FIRST BYTE 

SECOND BYTE 

THIRD BYTE 

LDA &H50A0 

B6 

50 

A0 

LDX LABEL 

BE 

70 

00 

LDB>WK 

F6 

55 

01 


N.B. In the above example, it is assumed that the address of LABEL is 
&H7000, that the address of WK is &H5501, and that DPR (Direct 
Page Register) contains the value of $55. 


In Figure 5-2-4 is shown the date flow in extended address format 


ACCA 


Memory 


$ 5500 
$ 5501 



Figure 5-2-4 Data Flow in Extended Address Format 
2-5-2 Extended Indirect Address Format 

In case of extended indirect address format, the content of the address 
designated by an operand becomes an effective address. The operand has 
to be bracketed by "C 3" to make this format. 













(93) 




MACHINE CODE 

b 1 AlrirrfciN 1 






FIRST BYTE 

SECOND BYTE 

THIRD BYTE 

FOURTH BYTE 

LDA CLABELH 

A6 

9F 

50 

10 

DEC CWK3 

6A 

9F 

01 

00 


In the above example.it- is assumed that the address of LABEL xs 
&H5010, that the address of WK is &H0100, and that the post byte 
in extended indirect address format is &H9F. As for the post 
byte, it will be described in detail at Section 2-7 (Index 
Address Format). 


In Figure 5-2-5 is shown the date flow in extended indirect address format 


ACCA 


Memory 




Figure 5-2-5 Data Flow in Extended Indirect Address Format 















(94) 


2-6 Register Address Format 

This is address format concerning the operation between registers, and 
a register name is designated in an operand. The instructions which 
can use this address format are TFR, EXG, PSHU, PULU, AND PULS. The 
register names designates in the operands are shown in Table 5-2-1. 

Table 5-2-1 Table of Register Names 


REGISTER NAME 

SYMBOL 

REGISTER NAME 

SYMBOL 

Accumulator A 

A 

X-Index Register 

X 

Accumulator B 

B 

Y-Index Register 

Y 

Double Accumulator 

D 

Hardware Stack Pointer 

S 

Condition Code Register 

CC 

User Stack Pointer 

U 

Direct Page Register 

DP 

Program Counter 

PC 


Example: TFR 

EXG 
PSHS 


A, B 
X, PC 

A, B, DP, Y 


This operand designated by the TFR and EXG instructions is shown in 
Figure 5-2-6. As for these two instruction, the two registers (Source 
and Destination Reqisters) have to be either 8-bit or 16-bit ones. 

b' b« ba ho 


Source 


Destination 


| _ 

4 bit 


i 

4 bit 


0 

0 

0 

0 ••• 

— D 

0 

1 

0 

1 •• 

0 

0 

0 

1 - 

•• X 

1 

0 

0 

0" 

0 

0 

1 

o ••• 

... Y 

1 

0 

0 

I •• 

0 

0 

1 

I - 

•U 

1 

0 

1 

0- 

0 

1 

0 

0- 

-S 

I 

0 

1 

1 - 


•PC 

A 

B 

CC 

DP 


Figure 5-2-6 


Operands of TFR and EXG Instructions 


The operands of PSH and PUL instructions are shown in Figure 5-2-7. 
If each bit is one, the corresponding register is Pushed or Pulled. 






































(95) 


The S register (Hardware Stack Pointer) cannot be designated as an 
operand for PSHS and PULS instructions. The S register (User Stack 
Pointer) cannot be designated either as an operand for PSHU and PULU 
instructions. 


bz 

b* 

bs 

b< 

bj 

bz 

bi 

bo 

PC 

s / 

OJ 

Y J 

X 

DP 

B 

H 

cc 


Order by P u 1 1 Instruction' 


Order by P u s h Instruction 


Figure 5-2-7. Operands of PSH and PUL Instructions 
2-7 Index Address Format 

In the HD6809 Assembly language, the 16-bit X, Y, U and S registers are 
called pointer registers which can be index-modified. Index address 
format is the one address-modified by these registers. Other than the 
above-mentioned registers, the program counter (PC) can be used as an 
index register. 

There are 8 index address formats. The operand has the post byte which 
decides on their classifications and offset values. As for index 
address formats, the number of bytes in machine codes is different 
dependent upon the value of the offset and its size. The relationship 
is shown in Figure 5-2-8. 



Figure 5-2-8 Offset and Number of Bytes 

The offset value is singed one and the range of the value is shown in 
the following: 

5 bit offset - -16 to 15 

8 bit offset - -128 to 127 

16 bit offset - -32768 to 32767 

In Table 5-2-2 is shown the relationship between address format and 
post byte. 






(96) 


The Assembler will automatically decide post bytes based on the operand 
description, its value, and the result of the calculation. 



* These- bytes are counted as fundamental machine cycles 

* The Assembler assembles these XX's as 00 





















































(97) 


2-7-1 Constant Offset Index Address Format 


This format calculates an effective address by adding the operand offset 
value and the content of the selected pointer register. The operand is 
described as follows: 

<Expression>, R 


The R takes either of X, Y, S, U, PC, and PCR. The PCR does not mean 
a register, but it means that the relative value of the program counter 
and the expression of an operand becomes an offset value. Where an 
operand is Expression, R, this is describes at Section 2-8-2 (Program 
Counter Relative). When an offset value is 0, you can omit "0" or 
and just designate the name of a register. 

Example: 


LAD 

LAD 



Either one is the same as LAD 


0,X 


N.B. This Assembler assembles the offset value as 0. 


The value that an offset can take is 16 bit 2's complement number, 
that is, -32768 to 32767. Depending on the value of an offset, the 
number of bytes varies. You can add ""or"" to an operand. If you put 
"<" before an expression, an offset value is an 8 bit one. 

Example: 

LAD >1,X 

N.B. The offset value is $0001 which is of two bytes. 

In Figure 5-2-9 is shown the data flow in constant offset index address 
format: 



Figure 5-2-9 Data Flow In Constant Offset Index Address Format 


(98) 


2-7-2 Constant Offset Index Indirect Address Format 

The effective address is calculated by adding the value of the selected 
pointer register and the offset value given by the expression of an 
operand. In this case, the effective address is of two bytes. To make 
this format, a register name is bracketed by "£ T in the following: 

C<Expression>, r3 

You can also add "<" or ">" to an operand. In Figure 5-2-10 is shown 
the date flow in constant offset index indirect address format. 





Figure 5-2-10 Data Flow in Constant Offset Index Indirect Address Format 








2-7-3 Accumulator Index Address Format 

The content of an accumulator is taken as an offset value. An effective 
address is calculated by adding the content of an accumulator and the 
content of a pointer register. An accumulator and a pointer register 
are designated in an operand. 

Example: 


A, B, or D is designated as an accumulator, X, Y, U, or S can be 
designated as a pointer register. In Figure 5-2-11 is shown the data 
flow in accumulator index address format. 


Memory 


Figure 5-2-11 Data Flow in Accumulator Index Address Format 













( 100 ) 


2-7-4 Accumulator Index Indirect Address Format 

An effective address is calculated by adding the content of an accumulator 
and the content of a pointer register. The effective address is of 
2 bytes. To make this address format, an operand is bracketed by 
"C 0". 

Example: 


LDA 

t-A, 


CMPA 

Cb, 

YJ 

LDD 

L D » 

UJ 


A, B, or D can be designated as an accumulator. X, Y, U, or S can be 
designated as a pointer register. 

In Figure 5-2-12 is shown the data flow in accumulator index indirect 
address format. 



Figure 5-2-12 


Data Flow in Accumulator Index Indirect Address Format 











( 101 ) 


2-7-5 Auto-increment Address Format 

An effective address is the content of a pointer register designated 
by an operand. After the execution, the content of the pointer register 
is incremented by 1 or 2. To make this address format, "+" or "++" is 
added after a register name. 

Example: 

LDA 0, X+ 

CMPA , X+ .... 0 is omitted 

CMPX Y++ .0 is omitted 

N.B. In case of "+", a pointer register is incremented by 1 
In case of "++", that is incremented by 2 

2-7-6 Auto-increment Indirect Address Format 

An effective address is the content at the location designated by a 
pointer register in an operand. After the execution, the pointer 
register is incremented by 2. To make this address format, "++" 
after the register name and the register name are bracketed by ” ". 

The offset value is defined as 0. 

Example: 

LDD CO, X++3 

CMPD C , U++3 .... 0 is omitted 

N.B. You have to add 2 +'s after a register name. Otherwise, an error 

takes place. 

2-7-2 Auto-decrement Format 

The content of a pointer register in an operand is decremented by 1 or 2. 
The content beocmes an effective address. To make this address format, 
you have to add " " or " " before a register name. The offset value 
is defined as 0. 

Example: 

LDA 0, _Y 

CMPA , U .... 0 is omitted 

ADDD X .... 0 is omitted 

N.B. In case of " ", a pointer register is decremented by 1 
In case of " ", that is decremented by 2 

2-7-8 Auto-decrement Indirect Address Format 

An effective address is the content at the location designated by the 
content of a pointer register minus 2. To make this address format, 

"_" before a register name and the register itself are bracketed by 

" ". The offset value is defined as 0. 




( 102 ) 


Example: 

LDD CO/ __X3 

CMPD ~ 

L—Ul .. .. O is omitted 

N.B. You have to add 2 's. Otherwise, an error occurs. 

2-8 Relative Address Format 
2-8-1 Short/Long Branch 

This is used for branching. For a short branch, an effective address 
is calculated by adding one byte offset value and the content of the 
program counter. For a long branch, that is calculated by adding two 
bytes offset value and the content of the program counter. The program 
counter contains the memory location of an instruction next to that 
under current execution. For short branching, jumping takes place in 
the relative range of -127 to 129. For long branching, jumping occurs 
over 64K bytes. 

Example: Address Machine Code 



BEQ 

LABEL 

1000 

27 

04 


ABX 


1002 

3A 



STX 

DATE 

1003 

BF 

5000 

LABEL 

LDA 

#$FF 

1006 

86 

FF 

Program 

Counter 

Relative 

Address 

Format 



This is relative address format concerning the program counter. The 
bperand value is assigned as the relative value designated by an operand 
in reference to the content of the program counter. An effective 
address is calculated by adding the value assigned in an operand the 
content of the program counter. When you use this address format, 
programs become relocatable. Even if program is located anywhere in 
the memory, it will be executed easily. The operand is described as 
follows. Or you can add "<" or ">" in an operand. 

<Expression>, PCR 

Example: 

JMP &H2000, PCR 

LEAU DATA+10, PCR 

LEAX DATA , PCR 


In Figure 5-2-13 is shown the data flow m program counter relative 
address format. 



LEAX DATA, PCR 


I S 1029 | (DATA) 

$ 1029 = S 100-1 + $0025) 



Figure 5-2-13 Data Flow in Program Counter Relative Address Format 

"LEAX DATA, PCR" is the same as "LDX"DATA" shown in Figure 5-2-13. 

But only the different point in LEAX DATA, PCR is that the operand is 
relative and that program can be located anyplace in the memory very 
easily. 

Supplementary: Expression , PC and Expression PCR are completely 
different when assembled. This is shown in the following: 


ADDRESS 

MACHINE CODE 

ASSEMBLY LANGUAGE 

EFFECTIVE ADDRESS 

518F 

A68CE1 

LDA $5803, PCR 

5803 

5822 




581F 

A68D5803 

LDA $5803, PC 

B026 

5823 

















(104) 


INSTRUCTIONS AND THEIR DETAILS 

Table 5-3-1 Table of HD6809 Instructions 



!■ 































LflLS 

BLT 

BLT 


LBLT 

BMI 

BMI 


LBMI 

BN'L 

BMC 


LBNE 

BPL 

BPL 


LBPL 

UK.\ 

UKA 


LUKA 

OR.N 

UH.N 


LURN 

BSR 

BSR 


LBSR 

BVC 

BVC 


LBVC 

BVS 

BVS 


LBVS 

CLR 

CLRA 


CLRB 


CLR 

CMP 

CMPA 


CMPB 


CMPO 


CMPS 


CMPU 


CMPX 


CMHY 

COM 

COMA 


COMB 


COM 

CM.W 


LAA 


DKC 

UKCA 


ULCU 


one 

KOH 

fcOHA 


tOHB 

kxi; 

HI. K2 


■■BEissiiziisiBsniaiis&ssicsziisai 

lESBBESBDEQRBEBBDGQRBEQSilli 


g 


IODDDDDI1DI 

IbdpdqbdbI 


4 Lm« Braack 

CVZ-l 

1 Braack N^V - I 

4 L*«| Braack 

N.-iV- l 

2 Snack N - l 

4 Lm( Braack 

. 1-1 

2 Braack Z - 0 

4 Laag Braaak 

Z-0 

2 Braack N - 0 

4 Laag Braack 

X - 0 

2 Braack Al»ar* 

) Laag Braack Alvapa 
2 Braack Navar 
4 Laag Braack N*»ar 


2 Braack la 

Safer awtiaa 
2 Laag Braack la 
Sakraaiiaa 
2 Braack V - 0 
4 Laag Braack 
V - 0 

2 Braack V - l 
4 Laag Braack 
V- l 
0 -A 
0 — B 
0—M 

Coagart M fraai A 
Compare M Iraai B 
Corner* M:Mfe l 
h*m D 

Cw«gara M.M 1 
lr*a S 

Ctaaan M:M *■ 1 

V 

Caaigara M:M* I 
tr a- X 

Caaa*r« M M fe 1 
hmm Y 
A -A 
B-B 
M-M 

CC A IMM -CC 

W*4 iac iaiarrwpt 
Dtciawl A4 |«m A 
A - 1 -A 
B - l -B 
M- 1 -M 
A M-A 
U *.M-B 
HI — RZ4) 






































( 106 ) 


IMP 

UIHECT 

EXTNU 

134 MED 

INDEX-0 

rnmvn 



B 

D 

B 

B 

B 

B 

B 

n\ 

m 

a 

a 

5J 

a 

□ 


a 

a 

m 

D 

a 

E22 

B 

□ 


51 

B 


* n 

□ 

□ 

□ 

B 

B 

B 

D 

□1 


2 

t 
















A 4. | -A 



• 





• 


2 

i 
















B 4- 1 ~B 

• 


a 





• 




OL' 

4 

2 

7 C 

7 

3 




AC 

A *• 

2 




M ♦ I —M 


• 

• 





• 




OE 

3 

2 

7 E 

. 

3 




AE 

3 4- 

2 * 




EA 1/—PC 



• 

• 

• 

• 

• 

a 




40 

7 

2 

UU 

A 

3 




AO 

7 4- 

2 ♦ 




JiMp I* SwArwttuM 

• 


• 


• 

• 

• 

* 




9 « 

4 

2 

BA 

S 

3 

A A 

2 

3 

A A 

«<> 

2 4- 




M-A 



• 




R 





06 

4 

2 

FA 

5 

3 

CA 

2 

2 

EA 

4- 

2 ♦ 




» 




• 


; 


R 





DC 

S 

2 

KC 

A 

3 

cc 

3 

3 

EC 

5 ♦ 

24- 




M M 4- 1 -D 



• 




R 

• 




1 0 

6 

i 

I 0 

7 

4 

1 0 

4 

4 

l 0 

6 4- 

3 4- 




M M 4- | 



• 




R 

• 




OF. 



FE 



CE 



EE 



















ok 

S 

2 

FE 

A 

3 

CF. 

3 

3 

EE 

3- 

2 4- 




M 

M *■ 1 **1 



• 




R 

• 




9 F. 

S 

2 

BE 

A 

3 

IK 

3 

3 

AE 

5 f 

2 «• 




M M t-l - X 

• 


• 




R 

• 




1 0 

A 

) 

1 0 

7 

4 

1 0 

4 

4 

1 o 

A ♦ 

3 ♦ 




M M 4* I -Y 

• 


• 




R 

• 




9 E 



OF 



• t 



AE 




























3 2 

4 * 

2 4- 




FA J • S 

• 


• 


• 

• 

• 

• 













3 3 

4* 

2 * 




KA J *t 

• 


• 


• 

• 

• 

• 













3 0 

4 f 

2 - 




EA 4—X 

• 


• 


• 

: 

• 

• 













3 1 

4 f 

2 - 




EA X * V 



• 


• 

j 

• 

• 


2 

2 

i 

i 
















A 

B 

CKLggm- 



• 

• 









0 A 

A 

2 

7 4 

7 

3 




A A 

4«- 

2 * 




M 

C fcr fc. 

• 


• 



: 



4 4 

2 

i 
















A 


• 


• 


R 


• 


S 4 

2 

i 

0 4 

A 

2 

7 4 

7 

3 




A 4 

o ♦ 

2 




B 

M 

^UlllilK) 

M to C 

• 

• 


• 

• 


R 

R 


: 


30 

1 1 

i 
















A*B -0 

• 


• 


• 

: 

• 

l 





























4 0 

2 

i 
















A 1 * A 

• 


4 






50 

2 

i 
















B 

l -B 

• 


K 









0 0 

• 

3 

7 0 

7 

3 




A 0 

A 4- 

2 4- 




M 

1 *M 

• 


i. 






1 3 

2 

i 
















V- 0|>»raiMMi 

• 


• 


• 

• 

• 

• 




9 A 

4 

2 

HA 

S 

3 

A A 

2 

2 

AA 

4 

2 + 




A 

M • A 

• 

• 

• 



; 

R 

• 




DA 

4 

2 

KA 

5 


CA 

l A 

2 

2 

F.A 


2 *■ 




H 

Nl »B 

IMM *CC 

• 

• 

• 


I 


R 

• 


















CC 



mm 




— 

— 


1 4 


2 
















i'mk ■<» 

• 

D 

□ 


• 

a 

• 

• 


• 


















S Stack 



■ 






3 n 

J-l 

2 
















I'wali Krtiiun mi 

• 

□ 

D 


• 

• 

• 

• 

1 5 


2 

















U Slack 

K»gi*iar» 

bum S Stark 

Nriitim 


1 

1 



























1 

1 

1 

1 




























lr*Mi L' Stark 

l 9 

2 

1 


















• 

• 

• 

• 



• 


5 9 

2 

1 

", 

‘ 

* 

7 •) 

7 





• 9 


2 




0 

M 

laaagfflJ 

• 

• 

• 

• 

• 

• 

• 

• 


. 

; 

; 


4 A 

2 

1 
















A 


• 

• 

• 

• 



• 


5 A 

2 

1 
















H 


• 

• 

• 

• 



• 


311 

4/M 


0*. 

6 

2 

7 A 

7 

3 




A 6 


2 * 




M 


• 

• 

• 

• 

1 


r 

a 


1 











































\mt*rr upt 









1 9 

3 

1 















1 Km»(« Itvm 

• 

• 

• 

• 

• 

• 

• 

• 


















1 

S«kr««liM 












>4 2 

4 

2 

0 2 

5 

3 

*4 2 



A 2 


2 ♦- 



i.v 

M - L *A 

• 

• 

4 

• 

: 







0 2 

1 

2 

K2 


3 

(.' 2 



K 2 

_ 


l ♦ 

, 


i 11 

1 

i 

_i_ 

M - C • H 

• 

• 

A 

• 


— 




































(107) 


St 


IMP 

DIRECT 

EXTND 

IMM tO 

1-NUtXD 

RELATIVE 

ft 

fV 

7 

4 

5 

4 

3 

2 

i 

0 


OP 

- 

2 

OP 

- 

2 

OP 

- 

2 

OP 

- 

2 

OP 

- 

s 

OP 

-1 

2 


E 

F 

H 

1 

N 

Z 

V 

c 

sex 


10 

2 

l 
















S>(■ Eiih 4 B iM* 

A 

• 

ft 

ft 

ft 

1 

• 

ft 

• 





















j 1+7.1 

FF-A 





























1 B/lbit’ -0 

0 -A 









ST 

STA 




9 7 

4 

2 

B 7 

3 

3 




A 7 

4 4- 

24- 




A-M 


• 

ft 

ft 

ft 

: 


R 

ft 


STB 




07 

4 

2 

F 7 

3 

3 




E7 

4 4- 

2 4- 




B -M 


• 

ft 

ft 

ft 

: 


R 

ft 


STD 




DD 

S 

2 

FD 

• 

3 




ED 

S-4- 

2 4- 




D-M M4- l 


• 

ft 

ft 

ft 

! 


R 

ft 


STS 




l 0 

4 

3 

l 0 

7 

4 




1 0 

4 ♦ 

3 4- 




S-M M4- | 


• 

ft 

ft 

ft 

1 


R 

ft 






OF 



KF 






F.K 

















STU 




OF 

s 

2 

FF 

4 

3 




EF 

S4- 

2 * 




U —M M 4- | 


• 

ft 

ft 

ft 

I 


R 

ft 


STX 




9 F 

s 

2 

BF 

• 

3 




AF 

5 4- 

2 ♦ 




X -M:Mt 1 


• 

ft 

ft 

ft 

: 


R 

ft 


STY 




t 0 

4 

3 

l 0 

7 

4 




l 0 

44- 

3 4- 




Y —MM ♦ 1 


• 

ft 

ft 

ft 

: 


R 

ft 






9 F 



BF 






AF 
















SIB 

SLBA 




90 

4 

2 

BO 

5 

3 

40 

2 

2 

A0 

4 4- 

2 4- 




A -M—A 


• 

ft 

t 

ft 

t 

l 




SL'BB 




no 

4 

2 

FO 

3 

3 

CO 

2 

2 

EO 

4 4- 

24- 




B - M — B 


• 

ft 

h) 

ft 

: 

: 




SL'BD 




9 3 

i 

2 

b 3 

7 

3 

• 3 

4 

3 

A3 

4 4- 

2 4- 




D-M Mt1 -0 


ft 

ft 

ft 

ft 

: 

: 



swi 

SWIvj) 

3 F 

19 

l 
















SoAwara mitrrwbi 

l 

S 

S 

ft 

S 

• 

• 

ft 

ft 


swi a:{> 

l 0 

VS 

2 
















S«A«ar« mtarriip* 

2 

S 

ft 

ft 

ft 

• 

• 

ft 

ft 



3F 





























swi j'D 

1 l 

.*0 

2 

















3 

s 

ft 

ft 

ft 

• 

• 

ft 

ft 



3 F 




























SYNC 


1 3 

4 2 

1 
















Sr»fkf»«in «• 


ft 

ft 

ft 

ft 

• 

• 

ft 

ft 

TKK 

Rl. R2 



















■•larrup* 




























R i H . 










TST 

TSTA 

40 

2 

1 
















Taai A 


ft 

ft 

ft 

ft 


i 

R 

ft 


TSTB 

SO 

2 

l 
















Taat B 


ft 

ft 

ft 

ft 


: 

R 

ft 


TST 




0D 

• 

2 

7 D 

7 

3 




60 

44- 

2 4- 




Ta»i M 


ft 

ft 

ft 

ft 


* 

R 

— 

ft 


N.B. Extended indirect and program counter relative commands will be 
described in "Index" column. 


SYMBOLS AND ABBREVIATIONS 


(1) Operation Symbols 

m Transfer Direction, Exclusive Or, = AND, += Arithmetic Addition, =OR, 
-= Arithmetic subtraction. 

(2) Abbreviation Symbols 

OP = Operation Code 

= Number of Cycles of MPU 
= Number of bytes of Instruction 

(3) Memory and Address Format 

M = Memory location 

M+l = Memory location plus 1 

IMM = Immediate value 

ACCM = Accumulator Address Format 

REG = Register Address Format 

DIRECT = Direct Address Format 

EXTND = Extended Address Format 

IMMED = Immediate Address Format 

INDEX = Index Address Format 

RELATIVE = Relative Address Format 

(4) Condition Code Register 
E(b7) = Entire Flag . 

F(b6) = FIRQ Master Flag * - • ' 

. H(b5) = Carry Flag from bit 3 to bit 4 










( 108 ) 


(4) Condition Code Register (continued) 

I(b4) = IRQ Master Flag 

N(b3) = Negative Flag -i 

Z(b2) = Zero Flag 

V(bl) = Overflow Flag in case of 2' Complement 
C(b0) * Carry Flag From bit 7 or Borrow Flag to bit 7 

(5) Symbols to Change the Content of Condition Code Register 

R = Set 
S = Reset 

= Set if the condition is satisfied. Otherwise, rest. 

= Unchanged 

(6) Notes on Condition Code Register 

(1) = In case of index mode, the necessary machine cycles and number 

of bytes in this Table to the values shown in Table 5-3-2. 

(2) * In case of EXG and TFR instructions, the Rl and R2 registers are 

either of 8 bits or of 16 bits. 8 bit registers:A, B, CC, DP and 

16 bit registers:X, Y, U, S, D, PC. 

(3) = EA stands for effective address. 

(4) = Instruction cycles for PSH/PUL 

This is calculated by adding the machine cycles shown in the 
table to the number of bytes of the register to be PUSHed or 
PULLed. 

(5) = 5(6) -5 cycles for non-branching 

6 cycles for branching 

(6) SWI sets the I and F flags. SWI2 and SWI3 unchanges I and F flags 

(7) The condition code is set by the result of an instruction 
executed. 

(8) = After this instruction has been executed, the H and V flags 

does not have any meaning. 

(9) = If b7 of the ACCB is 1 for the MUL instruction, the C flag 

will be set. 

(10) = If the CC is designated in an operand, this will be set 

according to the result of the instruction executed. But in 
case of the TFR instruction this will be set if the CC is 
designated in the destination. 



(109) 


e 5-3-2 Post Bytes of Indexed, Program Counter Relative, and Extended Indirect Modes 



ADDRESSING M< 

DDE 


NON- 

INDIRECT 



DIRECT 


ASSEMBLER 

FORMAT 

POST 

BYTE 

B 

+ 

# 

ASSEMBLER 

FORMAT 

POST. 

BYTE 

# 

+ 

# 



Zero Offset 

0, 

R 

1RR00100 

0 

0 

CO, 

r: 

1RR10100 

■ 

0 





R 


1 

o 




■ ; 



Offset 

8 bit Offset 

n, 

R 

1RR01000 

1 

1 

Ln, 

R3 

1RR11000 

9 

1 



16 bit Offset 

n, 

R 

. y 

1RR01001 

4 

2 

cn, 

R3 

1RR11001 

H 

2 



A Reg. Offset 

A, 

R 

1RR00110 

1 

0 

CA, 

R3 

1RR10110 

9 

0 


AcC UiUlild t-OL 

B Reg. Offset 

B, 

R 

1RR00101 

1 

0 

LB, 

R3 

1RR10101 


0 


ut rset 

D Reg. Offset 

D, 

R 

1RR01011 

4 

0 

ld, 

R3 

1RR11011 

9 

0 



Increment(+1) 

0, 

R+ 

1RR00000 

2 

0 

_____ 

_ 


_ 

_ 


Auto Incr. 

Increment(+2) 

0, 

R++ 

1RR00001 

3 

0 

ro. 

R++3 

1RR10001 

6 

0 

DEXED 

/Auto Dec. 

Decrement(-1) 

0, 

-R 

1RR00010 

2 

0 








Decrement(-2) 

0, 

— R 

1RR00011 

3 

0 

co. 

— R3 

1RR10011 

6 

0 

gram 

Program 


n. 

PCR 


I 

R 

L n » 

PCR 3 

1XX11100 

■ 


nter 

Counter 

8 bit Offset 

n. 

PC 


■ 

■ 

fn, 

PC 1 


9 


atives/ 






1 

1 




m 


stant 













set 

Relative/ 


n, 

PCR 




Cn, 

PCRl 



i 


Constant 

16 bit Offset 



1XX01101 

5 

2 



1XX11101 

8 

2 


Offset 


n. 

PC 




Cn, 

PCI 




ended i 

ndirect 

16 bit Offset 



B 

B 

C m 



2 


reviations: 


RR: 00=X 

01=Y 
10=U 
11=S 


X=Don't care 
(The Assembler under¬ 
stands that X is O.) 


4. 

_: Number of bytes to be added to the 
fundamental cycles. 

Number of bytes to be added to the 
basic machine cycles. 

























































pshu/pulu command 
post byte 


M 

be 

nr 

0 

0 

0 

0 

0 

bo 

hr 


cc 


I— A 
>— B 
•— DP 
X 
Y 


S 


PSHS/PULScommand 
■ post byte 


E 

0 

0 

0 

0 

E 

E 

bo 







- B 

DP 



_ 

Y 

X 



— 

u 






TFR/EXGCommand 


Q 

D 

D 

□ 

IS 

Q 

Q 

Q 






c 


register to be 

. , transferred, 

transfer star register 



b? bj 

bii b2 

bs. ' bi 

b 4 /bu 

£ 

0 

0 

0 

0 

0 

D 

1 

0 

0 

0 

1 

X 

2 

0 

0 

1 

0 

Y 

3 

0 

0 

1 

1 

u 

4 

0 

1 

0 

0 

s 

5 

0 

1 

0 

1 

PC 

8 

1 

0 

0 

0 

A 

9 

1 

0 

0 

1 

B 

A 

1 

0 

1 

0 

CC 

B 

1 

0 

1 

1 

DP 


B 












(Ill) 



Table 5-3-3 Quick Conversion TAble between Mnemonic and Machine Codes 


t. 

ii 


D 

D 

n 

n 

n 


n 

B 

B 

B 

B 

B 

C 

B 


B 


■ 

n 




ROR 


mm 

EES 

DEC 


INC 

T$T 

JMP 

CUR 

■ 








LSL 








uaui 

HH 

n 




(DIR) 

(DIR* 

(DIR) 

> DIR * 

i DIR) 


(DIR) 

(DIR) 

(DIR) 

(DIR) 

■■ 

H| 



warn 

mm 



mm 

DAA 

OR 



SEX 

EXC 

TFR 











ICC) 

■ 





m 

91 



m 

■ 



ifl 

v ACC) 

• IMM) 

■ 


(IMP) 

(REG ) 

(RECl 

IK 

1:1:971 

■WB 

IW 

BCC 

BCS 

I39S 

ES3 

E33 

BVS 

BPL 

BMI 

BCE 

BLT 

BGT 

BLE 





BHS 

BLO 











(REL) 

(REL) 

(REL) 

(REL) 

(REL) 

(REL) 

(REL/ 

( REL) 

(REL) 

' REL) 

(REL) 

(REL) 

(REL) 

(REL) 

(REL) 

(REL) 

LEA 

LEA 

LEA 



JSTuni 

KEKI 



RTS 

ABX 



MUL 


SW| 

(X ) 

(Y) 

(S ) 



tfil&lB 











(IND) 

(IND) 

(IND) 




wiwll 



(IMPi 

(IMP) 



(IMP) 


(IMPI 

NEC 




iCfl 



Kftii 

ASL- 




INC 



SSEl 

( A ) 




8551 



■I?]! 

LSUA1 




(A) 

HI® 



(ACC) 

19 



SI 



BSSa 

(ACC) 




(ACC) 

IH5BI 


«w«HI 

NEC 

| 


COM 

LSR 


ROR 

ASR 


ROt 

DEC 





bwki 

( B i 



(B) 

1 B 1 


( B ) 

l B ) 


( B ) 

( B > 



Ea 


Bn 

(ACC) 


MH 

(ACC) 

(ACC) 


(ACC) 

(ACC) 


(ACC) 

(ACC) 





BEa 

NEC 


■ 

COM 

LSR 

■ 

ROR 




DEC 


INC 

TST 

JMP 

CLR 



■ 














UNO) 

■ 

■ 

(LND) 

(IND) 

■ 

( IN D1 




(IND) 


(IND) 

(IND) 

(IND) 

(IND) 

NEC 

■■ 











INC 









■ .>• 










Ml 

(EXT) 

■ 

■ 



■ 







(EXT) 



uSO 


CMP 

SBC 

SUB 

AND 

BIT 

LD 

mm 


ADC 

OR 

ADD 

CMP 

BSR 

LD 

SSH 


( A ) 

( A ) 

(Dl 

( A ) 

( A ) 

( A ) 



( A 1 

( A ) 

( A ) 

( X ) 


(XI 

■H 


(IMM) 

(IMM) 

(IMM) 

(IMM) 

(IMM) 

(IMM. 



' IMM) 

i IMM) 

(IMM» 

(IMM) 

(REL) 

(IMM) 

HH 

SUB 

CMP 

SBC 

SUB 

AND 

BIT 

LD 

ST 

EOR 

ADC 

OR 

ADD 

CMP 

JSR. 

LD 

ST 

( A ) 

(A) 

(A) 

( D 

(A) 

(A) 

(A ) 

l A 1 

( A ) 

1 A ) 

( A » 

( A ) 

(X) 


(X) 

(X) 

(DIR) 

(DIR) 


(DIR) 

(DIR) 

(DIR) 

(DIR) 

(DIR) 

(DIR) 

DIR) 


(DIR) 

(DIR) 

(DIR) 

(DIR) 

(DIR) 

SUB 


SBC 

SUB 

AND 

BIT 

LD 

ST 

EOR 

ADC 

OR 

ADD 



LD 

ST 

(A) 


(A) 

■Til 

(A) 

( A ) 

I A 1 

(A ) 

(A > 

• A ) 

( A ) 

' A ) 



(X) 

(X) 

(IND) 


(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND/ 

IND • 

IND) 

(IND) 



(IND) 

(IND) 



SBC 

SUB 

AND 

BIT 

LD 




Or 

ADD 

CMP 

JSR 


ST 



(A) 

(D) 

( A ) 

( A » 

( A » 




( A ) 

( A ) 

(X) 

> 


(X) 



(EXT) 

(EXT) 

(EXT) 

(EXT) 

(EXT. 




(EXT) 

'EXT) 

(EXT) 

(EXT) 


(EXT) 




ADD 

AND 

BIT 

LD 


EOR 

ADC 

OR 

ADD 

LD 


LD 





( D ) 

( B) 

( B ) 

i B i 


( B ) 

( B ) 

( B l 

( B) 

( Dl 


( U ) 





(IMM) 

(IMM) 

(IMM) 

(IMM) 


(IMM) 

(IMM) 

• IMM) 

(IMM) 

(IMM) 


(IMM) 


SUB 

CMP 

SBC 

ADD 

AND 

BIT 

LD 

ST 

EOR 


OR 


LD 

ST 

LD 

ST 

( B) 

(B) 

( B ) 

(D) 

( B) 

( B) 

( B 1 

( B ) 

( B i 


( B ) 


(Dl 

lD> 

(U) 

(U . 

(DIR) 

(DIR) 

(DIR l 

(DIR) 

(DIR) 

(DIR) 

(DIR) 

'DIR) 

(DIR) 




(DIR) 

(DIR) 

(DIR) 

(DIR) 

SUB 

CMP 

SBC 

AOO 

AND 

BIT 

LD 

ST 

EOR 

ADC 

OR 

ADD 

LD 

ST 

LD 

ST 

( B) 

( B ) 

(B) 

(D) 

( B) 

( B ) 

(B) 

( B ) 

( B 1 

( B i 

(B) 

I B ) 

( D I 

(Dl 

( U) 

(U ) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

( IND ) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

(IND) 

SUB 

Ea 



AND 

BIT 

LD 

ST 

EOR 

ADC 


ADD 

LD 

ST 


ST 

( B) 

frn 



( B ) 

( B ) 

I B ) 

( B) 

( B) 

( B ) 


(B) 

(Dl 

(D) 


(U ) 

(EXT) 




(EXT) 

(EXT) 

(EXT) 

.EXT) 

(EXT) 

EXT' 


(EXT) 

(EXT) 

(EXT) 


(EXT) 


DIR=Direct Addressing 
EXT=Extended Addressing 
IMM=Immediate Addressing 
IND=Indexed Addressing 
IMP=Implied Addressing 
REL=Relative Addressing 
REG=Register Addressing 
ACC=Accumulator Addressing 


A=Accumulator A 

B=Accumulator B 

D=Double Accumulator 

X=X Index Register 

Y=Y Index Register 

S=Hardware Stack Pointer Register 

U=User Stack Pointer Register 

CC=Condition Code Register 


★ 

★ * 


Refer to No. 2 
Refer to No. 3 







































































































(112) 


NO. 2 


Table 5-3-3 Quick Conversion Table between Mnemonic and Machine Codes 
All the instructions shown below of the first byte being $10 



D 

n 

fl 

B 

B 

B 

B 

B 

fl 

fl 

fl 

B 

C 

fl 

E 

F 

0 



















■ 

■ 


B 

B 

B 

B 

B 

fl 

fl 

B 

■ 

■ 

■ 

■ 



LBRN 

' REL > 

LBHl 

(REL) 


LBHS 
LBCC 
• REL) 

LBCS 
LBLO 
i REL 1 

LBNE 

REL, 

LBEQ 

REL 

LB VC 

' REL' 

LB VS 

REL 

LBPL 

. REL: 

LB Ml 

REL* 

LBCE 

REL- 

LBLT 

(REL) 

LBCT 

1 REL > 

LBLE 

iREL. 

















SWI2 

















•IMP) 

















■ 

















■ 

















■ 





§ 










1 


■ 





C.MP 
(Di 
• IMM • 









CMP 

Y ) 

i (MM I 

' 

LD 

< Y) 

(IMM i 





i 

CMP 

( D ) 

DIR) 









CMP 
< Y ) 

t DIR i 


LD 

< Y > 

I DIR i 

ST 
( Y ) 

(DIR» 





CMP 

( D 1 
• IND) 









CMP 

' Y) 

( IND * 


LD 

■ Y » 

< IND) 

ST 

( Y ) 

1 IND l 

B 




CMP 

' DI 
» EXT • 









CMP 

1 Y i 
•EXT) 


LD 

( Y i 

'EXT) 

1 

D 




n 




| 





B 


LD 

(1) 

• IMM ) 

■ 

D 




■ 











LD 

!S, 

'DIR) 

ST 
« S ) 

• DIR ) 

E 




fl 




1 





fl 


LD 

»f i 
(IND) 

ST 

»3l 

I IND * 

fl 


i 


B 





| 


■ 




LD 

(EXT! 

ST 
< S ) 
(EXT) 























































(114) 


APPENDIX 

MODIFICATION OF THE SOURCE TOP ADDRESS OF YOUR SOURCE PROGRAM 


When you save your source program made by the Assembler on cassette or 
diskette by using the S command, the system saves the source top address 
other than the content of your source program. 

Your source program will be managed under the file name and the source 
top address. Therefore, when you load your source program into the 
RAM from cassette tape or diskette, you have to designate the source 
top address and the file name. 

If the source top address type in through the keyboard is different 
from that recorded on cassette tape or diskette, there is no guarantee 
that your source program will be loaded correctly. You had better 
write down the file name and the source top address. And you have to 
designate the same file name and source top address when you load your 
source program. 

Because your source program is managed under the file name and the 
source top address, you cannot load into the different memory locations 
by modifying your source top address once saved on cassette tape or 
diskette. As shown in the following example, you can load your source 
program at the different memory locations from those recorded on cassette 
tape or diskette. 

Example: 

For example set the screen mode of Basic Master Level-3 to the 
80 character mode (normal mode). the system has to be set in the 
Assembler mode. You have to designate the source top address as 
&H2000 through the keyboard and to make your source program. And 
after that you have to save this source program under the file name 
of TEST on cassette tape or diskette. In this case the source program 
will be managed in the following: 

(1) Source Top Address: SH2000 

(2) File Name: "TEST" 

In case this source program is loaded at the memory loaction of SH3000 
and thereafter) the following procedures are needed: 

(In The Assembler Mode) 


*ASMB/EDITR_V2.0 

(1) :NEW/RAM/EXTM? | N | You have to type in the | N \ key. 

(2) /SOURCE TOP ADDR? 3000 | RETURN 

+ Designate the Source Top Addr. 

(3) / 1 E | -You have to key in E while the system is waiting for an 

editor command. (This instruction returns the system to 
the BASIC mode.) • . " - 




(115) 


(4) LOADM" Device Name : TEST", &H1000 | RETURN 


Refer to * to calculate the offset 
value 

(This instruction loads your source program under the file name 
of "TEST" at the memory lcoation of &H3000 and thereafter). 

(5) EXEC&H5000 

(This instruction puts the system in the Assembler mode.) 
*ASMB/EDITR_V2.0 

(6) :NEW/RAM/EXTM? | R | Type in the | R [ key. 

/ -_-_'£h e , system is waiting for an editor command 

t_ Blinking Cursor 

(It is quite possible to compile your source program by editor 
commands.) 

The source program, the source top address of which has been changed 
from &H2000 to &H3000 has to be saved on cassette tape or diskette 
by the S command in the Editor under the file name of TEST. The 
file will be managed under: 

(1) Source Top Address: &H3000 

(2) File Name: TEST 

* Method of Calculating Offset Value: 

Offset Value = Source Top Address - Source Top Address of 

Designated by Keying in your Source Program to 

be loaded 


In the above example, the offset value is: 
&H1000 = &H3000 - &H2000